Using VBA in excel, how would I execute a macro every time I switched between sheets?
Wed, 12/16/2009 - 05:10
Hi all,
Using VBA, how could I have a macro executed automatically every time I select a new sheet within the workbook. To make it even more challenging, how could I set it so up so a different macro is executed depending on which sheet I had selected.
Thanks for any help
Chris (running excel 93)
Tue, 01/26/2010 - 10:34
#2
With worksheet activate
With worksheet activate event, put VBA in local sheet (right click tab, select view code)

See the screenshot below. Go to VBE window , double click and then put this code in VBE and between these you can do whatever you want.
This will execute as soon as you activate a sheet. I hope this helps.