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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Why don't you test the Visible property of the sheet before running the macro?
 
Upvote 0

Forum statistics

Threads
1,216,084
Messages
6,128,730
Members
449,465
Latest member
TAKLAM

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