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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel: Check active sheet before running macro 1

Status
Not open for further replies.

krets

Technical User
Dec 29, 2006
214
US
How would I create an If statement to check the name of the active sheet and only continue to run if a certain sheet or sheets are active?

In this case I only want a macro to run if the "Data Processing" sheet is currently active. Otherwise I'm going to pop up a message box.

Is there an "ActiveSheet" property like there is an "ActiveCell"?
 
->Is there an "ActiveSheet" property like there is an "ActiveCell"?

There sure is!

Code:
if not activesheet.name = "Data Processing" then exit sub
...

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top