ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run Macro on Worksheet Activate (https://www.excelbanter.com/excel-programming/292213-run-macro-worksheet-activate.html)

Matthew John Antoszkiw

Run Macro on Worksheet Activate
 
Hello,
I'm trying to run some code when a worksheet is activiated (when the user
views it via the tabs). I tried using this code and adding to the worksheet
I wanted via the VBA editor:

Private Sub Worksheet_Activate()
'do stuff
msgbox("TEST")
End Sub

Nothing happens when the worksheet is activated. What am I doing wrong?
many thanks.



Colo[_95_]

Run Macro on Worksheet Activate
 
Hello Matthew,

That code works on me, please try type the code below in the immediat
window and press Enter key.

Application.EnableEvents may has been set as False.


Code
-------------------

Application.EnableEvents=True

-------------------


--
Message posted from http://www.ExcelForum.com


Emiel[_2_]

Run Macro on Worksheet Activate
 
You did put it in "Sub auto_open()", right?


All times are GMT +1. The time now is 05:44 PM.

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