View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips[_3_] Bob Phillips[_3_] is offline
external usenet poster
 
Posts: 2,420
Default Automatic Macros


Private Sub Workbook_SheetActivate(ByVal Sh As Object)

Select Case Sh.Name

Case "Sheet1": 'do something
Case "Sheet2": 'do something else
End Select
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
__________________________________
HTH

Bob

"David Fredrickson" <David wrote in
message ...
How can I automatically initiate a macro when I switch tabs within a
worksheet