Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run macro when worksheet opens

Status
Not open for further replies.

Ham

Technical User
Feb 23, 2000
122
US
I want to run a VBA routine attached to a worksheet whenever that worksheet is displayed. How can I do this?

Thanks. -- Ham
 
Ham,

Use the OnActivate event for the worksheet. To do this, open the VBA Editor. Select the worksheet in the Project window then click the view code button. Select Worksheet from the left dropdown then Activate from the right. The editor will write the event procedure shell. Just add your VBA code here. It will run each time the specified worksheet is activated.


Regards,
M. Smith
 
Works like a charm. Thank you very much. -- Ham
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top