ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Call an Excel Macro when a Sheet is selected (https://www.excelbanter.com/excel-programming/279779-re-call-excel-macro-when-sheet-selected.html)

[email protected]

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



All times are GMT +1. The time now is 04:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com