ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Can a macro format a hidden sheet? (https://www.excelbanter.com/excel-discussion-misc-queries/12302-can-macro-format-hidden-sheet.html)

Robert

Can a macro format a hidden sheet?
 
I have an open sheet, which is only open to record the macro. Then I hide
the sheet and use the keyboard shortcut to clear the hidden sheet. This
won't work. I get an error in the Sheets("report").select area. Guessing
because it can't select a sheet that it doesn't see. If I unhide the sheet,
the macro works fine. How can I make this work and still have the sheet
hidden?

Also, what's the difference between hidden and very hidden? Thanks.

Gary Brown

Robert,
Refer to the hidden sheet by it's name, such as 'Sheet1'.
For example:
Sheets("Sheet1").Range("A1:A16").ClearContents

Hidden sheets can be seen from the FORMAT / SHEET / HIDE[UNHIDE] form.
Very Hidden sheets can only be seen in the Visual Basic Editor.
HTH,
Gary Brown


"Robert" wrote:

I have an open sheet, which is only open to record the macro. Then I hide
the sheet and use the keyboard shortcut to clear the hidden sheet. This
won't work. I get an error in the Sheets("report").select area. Guessing
because it can't select a sheet that it doesn't see. If I unhide the sheet,
the macro works fine. How can I make this work and still have the sheet
hidden?

Also, what's the difference between hidden and very hidden? Thanks.



All times are GMT +1. The time now is 11:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com