Search code examples
excelvbaeventsactivation

Worksheet_Activate not triggering when workbook opened


Two days ago my code to populate ActiveX combo boxes in my Excel sheets stopped functioning when I open the document. I have since discovered that the Worksheet_Activate() no longer triggers when I open sheets.

Now even if I create a simple workbook with only the following code in Sheet 1, it doesn't trigger when I open the workbook.

Private Sub Worksheet_Activate()
   MsgBox ("Worksheet has been activated")
End Sub

However, if I click on another tab and click back to the sheet containing the code, it does trigger.

I have tried playing with adding Application.EnableEvents = True and Worksheets("Sheet1").Activate to the Workbook_Open (which does trigger) but still no luck.

We're running Excel 2010 and the same problem is occurring on my colleagues' machines as well. Any ideas?


Solution

  • In your Workbook_Open event turn off ScreenUpdating, activate a different sheet, activate the sheet you want the event to fire, turn ScreenUpdating back on.