Selected Sheet Hidden; ERROR can't run macro

jtk911

New Member
Joined
Sep 6, 2007
Messages
23
I have several sheets that need to have an application run, but only if it is not hidden.

This is what I currently have and the macro stops to debug when it the sheetX is hidden.

Sheet5.Select
Application.Run _
"'Program Spend Statement - Master Template.xls'!RemoveAndClear"
Sheet7.Select
Application.Run _
"'Program Spend Statement - Master Template.xls'!RemoveAndClear"
Sheet9.Select
Application.Run _
"'Program Spend Statement - Master Template.xls'!RemoveAndClear"
Sheet11.Select
Application.Run _
"'Program Spend Statement - Master Template.xls'!RemoveAndClear"
Sheet13.Select
Application.Run _
"'Program Spend Statement - Master Template.xls'!RemoveAndClear"
Sheet14.Select
ActiveWindow.SelectedSheets.Visible = False
ActiveWindow.SelectedSheets.Visible = False
Sheet1.Select
Range("C22").Select
Range("C8").Select

Please help. Thanks.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Why don't you test the Visible property of the sheet before running the macro?
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,707
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top