ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro cannot access hidden sheet (https://www.excelbanter.com/excel-programming/420890-macro-cannot-access-hidden-sheet.html)

MichaelRobert

Macro cannot access hidden sheet
 
My macro works fine until I hide a sheet that it needs to use. The code stops
at the last line below:

Dim r As Range
Sheets("Main Page").Select
If IsError(Range("B3").Value) = False Then GoTo DoubleClick
Set r = Range("D5:M5")
Sheets("Part Numbers").Select
<

Unhiding the sheet (Part Numbers) clears up the problem, but I would prefer
to have it hidden.

What's the trick?

Thanks.

Mike

Mike H

Macro cannot access hidden sheet
 
Hi,

You have choices.

1. Fleetingly unhide your sheet with code, do what you want and then re-hide
it.

2. Do what you need to do without selecting the sheet. For example this
works perfectly on a hidden sheet

Sheets("Sheet1").Range("A1").Value = 999

If you need help with the latter option we would need to see your code.

Mike

"MichaelRobert" wrote:

My macro works fine until I hide a sheet that it needs to use. The code stops
at the last line below:

Dim r As Range
Sheets("Main Page").Select
If IsError(Range("B3").Value) = False Then GoTo DoubleClick
Set r = Range("D5:M5")
Sheets("Part Numbers").Select
<

Unhiding the sheet (Part Numbers) clears up the problem, but I would prefer
to have it hidden.

What's the trick?

Thanks.

Mike


John Bundy

Macro cannot access hidden sheet
 
You can change application.screenupdating = false before you access it and
the user would never see a thing either. Set back to trued after you have
rehidden of course.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Mike H" wrote:

Hi,

You have choices.

1. Fleetingly unhide your sheet with code, do what you want and then re-hide
it.

2. Do what you need to do without selecting the sheet. For example this
works perfectly on a hidden sheet

Sheets("Sheet1").Range("A1").Value = 999

If you need help with the latter option we would need to see your code.

Mike

"MichaelRobert" wrote:

My macro works fine until I hide a sheet that it needs to use. The code stops
at the last line below:

Dim r As Range
Sheets("Main Page").Select
If IsError(Range("B3").Value) = False Then GoTo DoubleClick
Set r = Range("D5:M5")
Sheets("Part Numbers").Select
<

Unhiding the sheet (Part Numbers) clears up the problem, but I would prefer
to have it hidden.

What's the trick?

Thanks.

Mike



All times are GMT +1. The time now is 07:24 PM.

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