I have a worksheet which besides other things the worksheet also contains pivot table.
The code in that worksheet is copied from support microsoft dot com :
Range("X5:X100") is in a Validation state with a drop down list aaa, bbb, ccc.
Basically, I want only if the value of any cell (based on the user choose from the validation list) in Range("X5:X100") is "ccc" then run the macro.
It works well.
However when I change any value outside Range("X5:X100"), it gives me Run-time-error "91" : Object variable or With block variable not set.
For example, after I type "anything" in Range("A1"), it gives me that error. The same thing if I delete that "anything" text (so now A1 is blank), it gives me that error.
I thought the command [ If Application.Intersect(KeyCells, Range(Target.Address)).Value = "ccc" ] is something like :
ONLY if any cell within Range("X5:X100") value is "ccc" then do something
Consequently (I thought) :
A. if any cell inside Range("X5:X100") is changed but not contains "ccc" then do nothing
B. if any cell outside Range("X5:X100") is changed then do nothing
Point A works well, but point B gives me that error.
How do I resolve the problem ?
Any kind of help would be greatly appreciated.
Thank you in advanced.
Bookmarks