I have this line in VBA:
Application.VLookup(“Coded#1”, Range(“CodedItems”), 2)
If I run this in the immediate window before my code runs, it works (and I get the correct cell-value returned). Now I need this in a routine that is called after I change a cell. So I’ve started to set-up a WorkSheet_Change routine (where in the first line, I of course disable Events). Now here’s the strange part… if I set a code stop in this routine (with F9) and then go back to my immediate window and run the same line as shown above again, I get:
Run-time error ‘1004’:
Application-defined or object-defined error
Then I step through the code (there are no errors as I do not yet have the above line inserted) and end it. Now I run the line above again from the immediate window and all works again!!!
Note: I’m NOT changing the “CodedItems” range in the mean time, nor am I even accessing it…
Any idea why this doesn’t work??