diable macro if a certain sheet is active

B

belvy123

How can I disable a macro from running if a certain sheet is active.
example

if sheet "new" is active I can run a macro that will hide certain rows
if sheet "old" is active the same macro will not be able to hide the rows in
the macro

any ideas??
 
S

Shane Devenshire

Add the following line at the beginning of the macro

If ActiveSheet.Name = "old" then Exit Sub
 
J

Jacob Skaria

Add the below at the beginning of the marco.

If ActiveSheet.Name <> "New" then Exit Sub

If this post helps click Yes
 
R

Rick Rothstein

Your question leaves out a detail that I think is necessary for us to
know... what if the rows are already hidden and the "old" sheet is made
active... should the code unhide the rows in that situation?

In order to get a better answer, you should post your code so we can tell
you how to change it to do what you want.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top