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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Why don't you test the Visible property of the sheet before running the macro?
 
Upvote 0

Forum statistics

Threads
1,215,454
Messages
6,124,931
Members
449,195
Latest member
Stevenciu

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