View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] pfsardella@yahoo.com.nospam is offline
external usenet poster
 
Posts: 172
Default Call an Excel Macro when a Sheet is selected

Right click on the Sheet Tab. Select 'View Code'. Place this in the
module.

Private Sub Worksheet_Activate()
Call MyExcelMacro
End Sub

Each time that the worksheet is activated, your MyExcelMacro will run.

Here are some links that have good info on events. You are using the
Worksheet_Activate Event.

http://www.mvps.org/dmcritchie/excel/event.htm
http://www.cpearson.com/excel/events.htm

http://support.microsoft.com/default...20&Product=xlw
http://support.microsoft.com/default...b;EN-US;291294
http://support.microsoft.com/default...b;EN-US;161761

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------
Hi,

I was wondering if someone could help me with some simple code to Call
an Excel Macro I have when a Sheet (tab) is first selected.

Thanks, Grant