Run Code in General Module Upon Activation of Other Sheets

  • Thread starter Thread starter steveski
  • Start date Start date
S

steveski

I have VBA code residing in a general module of a workbook. The outpu
from the code updates several sheets in the workbook. I would like t
automatically Run the code in the general module if any of thes
several sheets are activated (by clicking on the sheet’s tab). How ca
I do this?

Thanks
 
Hi Steve

You can use the folowwing events in the sheet module(not a normal module)

Right click on a sheet tab and choose view code.
Paste the events in there and press Alt-Q to go back to Excel.

You can copy the code in the event or type the macro name in the event

Private Sub Worksheet_Activate()

End Sub

Private Sub Worksheet_Deactivate()

End Sub
 
Back
Top