err.Description: Application-defined or object-defined error
For code context review last post in this thread (it's virtually the same as what I have now)
What I don't understand is no matter what syntax I use to set a cell interior colour it raises that error. BUT if I step through the code and in the immediate window (iw) I use that exact line, I can set the interior colour to whatever value I choose. That works regardless of whether or not I comment out the line that raises the error. The easiest approach for verifying this is to put a break point on Exit Function and use the iw to issue the command before I lose the variables. When the code is finished, the interior colour is whatever value I used in the iw but only if I use the iw. When the code errors, it does not set the interior colour.
Why can I set the value in the iw but not in code when using the exact same code line?
I have tried Do Events, cycling EnableEvents and passing the range address and colour value to an outside function yet the error persists. I am stumped. I could trap 1004 and ignore it but not only does that seem to be a hack, then the colour still cannot be set. Can anyone explain this behaviour?
For code context review last post in this thread (it's virtually the same as what I have now)
What I don't understand is no matter what syntax I use to set a cell interior colour it raises that error. BUT if I step through the code and in the immediate window (iw) I use that exact line, I can set the interior colour to whatever value I choose. That works regardless of whether or not I comment out the line that raises the error. The easiest approach for verifying this is to put a break point on Exit Function and use the iw to issue the command before I lose the variables. When the code is finished, the interior colour is whatever value I used in the iw but only if I use the iw. When the code errors, it does not set the interior colour.
Why can I set the value in the iw but not in code when using the exact same code line?
I have tried Do Events, cycling EnableEvents and passing the range address and colour value to an outside function yet the error persists. I am stumped. I could trap 1004 and ignore it but not only does that seem to be a hack, then the colour still cannot be set. Can anyone explain this behaviour?