#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Automatic Macros

How can I automatically initiate a macro when I switch tabs within a worksheet
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 793
Default Automatic Macros

Right-click the Sheetname and select 'View Code'...
In the VB Editor put your code between

Private Sub Worksheet_Activate()

End Sub

this will be executed everytime the sheet is activated

"David Fredrickson" wrote:

How can I automatically initiate a macro when I switch tabs within a worksheet

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 macros - how to merge 5 macros together into one Sue Excel Discussion (Misc queries) 1 April 16th 08 08:36 PM
Macros warning always shows up, even if all macros removed Joe M Excel Discussion (Misc queries) 1 December 20th 07 04:45 AM
How to enable macros and automatic calculation on Excel Viewer? David Excel Worksheet Functions 2 April 5th 07 08:53 PM
Macros - copying macros from one computer to another TT Excel Discussion (Misc queries) 18 December 14th 06 03:24 AM
Training: More on how to use macros in Excel: Recording Macros ToriT Excel Worksheet Functions 2 February 10th 06 07:05 PM


All times are GMT +1. The time now is 02:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"