Workbook Deactivate event seems to occur too late
Just curious, as this has bit me more than once.
Why is the Workbook Deactivate event fired *after* the ActiveWorkbook
has already been changed? It makes referencing cells in the
"deactivating" workbook unaddressable using simple Ranges. I've had to
resort to changing my code from this:
set llr = Range("LogLevel")
to this:
set llr = ThisWorkbook.Sheets("Support").Range("LogLevel")
in order to get and set data in the workbook being deactivated.
Besides being more complex of an expression, this would also be a
problem if needed to change the name of the sheet.
Anyone know why the event isn't fired *before* the ActiveWorkbook is
changed? Is there an easier or more general way to refer to ranges
that is immune to this issue? Can I specify a global named range in
another workbook (in this case, ThisWorkbook) without specifying the
sheet name?
What are best practices for referring to named ranges?
Thanks
tbone
|