Refer to a hidden sheet using a macro.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have written a macro that will move data into a sheet that is hidden.
However, when I run it I get the debugger message telling me it has failed.
If I unhide the sheet and run it then it works fine.

What is the best way round this?

Thanks in advance.
 
I have written a macro that will move data into a sheet that is hidden.
However, when I run it I get the debugger message telling me it has failed.
If I unhide the sheet and run it then it works fine.

What is the best way round this?

Thanks in advance.
What is the code that moves the data? My guess is you are activating or
selecting something on the hidden sheet.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Multi-disciplinary business expertise
+ Technology skills
= Optimal solution to your business problem
Recipient Microsoft MVP award 2000-2005
 
just don't activate or try to select the hidden sheet

this copies data from sheet1 to sheet2 when sheet2 is hidden.

Range("A1").Copy Sheets("Sheet2").Range("D3")

edit the existing code and just reference the hidden sheet when you do your
copying.
 
fullers said:
I have written a macro that will move data into a sheet that is hidden.
However, when I run it I get the debugger message telling me it has failed.
If I unhide the sheet and run it then it works fine.

What is the best way round this?
If it is in a macro, run a code to unhide the sheet and then once the work
in this sheet hide it again. Substitute "hidden sheet" for your sheet

Dim UNHIDESHEET
Sheets("HiddenSheet").Visible = True

Dim HIDESHEET
Sheets("References").Visible = False

Cheers
 
You can write to a hidden sheet, but I suspect your code has activates or
selections in it which will fail if the sheet is hidden.

Post your code for someone to show you how to remove these.

--

Regards,
Nigel
(e-mail address removed)
 

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

Back
Top