Macro cannot access hidden sheet

M

MichaelRobert

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
 
M

Mike H

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
 
J

John Bundy

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top