Worksheet activate event doesnt trigger looping thru all visible sheets (no Sheet2)

  • This is weird. I have a workbook with macros working fine on Friday, Monday they don't. Behavior is it would loop through all the visible sheets, but never trigger the worksheet activate event except when I re-activate the sheet that was active when the code was triggered. Only thing I can think of is I deleted an unused sheet (Sheet2) sometime before end of day Friday. I may not have checked behavior after doing that (who knew?). I renamed the sheets so that I now have Sheet2, but that didn't fix it. It only works if I loop backwards; it might have skipped Sheet1 when looping backwards before I renamed them (don't recall).


    I suppose it doesn't matter which way I loop as long as it works, but it's so weird. Can't find anything similar online. Known "undocumented behavior"? Am I doing something wrong? Sorry if this is too long, I condensed as much as I could. Thanks in advance for your help!


    Here's the stripped down code:


    Individual sheets have this code:

    Code
    Private Sub Worksheet_Activate()
    'debug statement here showed it triggered outside of loop, but not within loop.
      If IsRunChecks Then
         'my code here
      End If
    End Sub
  • OH my goodness, I just figured this out. If I'm already on the first sheet in the loop, of course it won't trigger (there's some vba magic for that, I remember seeing it somewhere...). :0ops:


    How do I close this thread please.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!