diable macro if a certain sheet is active

  • Thread starter Thread starter belvy123
  • Start date Start date
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??
 
Add the following line at the beginning of the macro

If ActiveSheet.Name = "old" then Exit Sub
 
Add the below at the beginning of the marco.

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

If this post helps click Yes
 
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.
 
Back
Top