Deactivate event not firing

Joined
May 4, 2010
Messages
4
Reaction score
0
I am trying to refresh all pivot tables when a sheet is deactivated but it does not fire at all, ever. If I run the simple macro it works but not when I leave the sheet and go to another sheet. I have placed the code on the sheet, and to test, added a MsgBox but it just simply does not fire.
After reading many posts, I commented out all occurrences of enableEvents = false even though they were all paired with an enableEvents = true at the end of the macro - used the find feature to find all within the project. I have saved, closed and opened again
Still no luck.
Here is the code as it stands - it seems pretty harmless - but I am just learning code and cannot find anything anywhere that discussed causes for a deactivate code to not work. Any and all suggestions are welcome. I did try on a new excel workbook but I didn't get the message box there either - so clearly I am doing something wrong, and it is probably real obvious:)
Thanks in advance!

Code:
Private Sub Worksheet_Deactivate()

Application.EnableEvents = True
ThisWorkbook.RefreshAll
MsgBox "this sheet was deactivated"

End Sub
 
Hi all
Since it seemed an excel wide problem, in desperation I shut down excel and started up again, and things seem to be working correctly. Just thought I would post this as a possible "solution" in case someone else is having the same problems. Closing and opening the workbook did not solve the problem, only closing down excel.
Cheers
V
 
Back
Top