Hiding/Unhiding multiple sheets in VBA?

S

Simon Lloyd

Hi all,

Im trying to hide and unhide sheets in an auto_open/close so that the
user has to enable macro's to view the rest of the sheets i can hide
them ok but unhiding is proving a problem heres what i have tried. This
below was to hide in the autoclose, and below it is my auto_open which
then calls the code that used to be my Auto_open but sheets wont unhide
and i a get method of selection class error, im using excel 2003 winxp

thanks,

Simon

Sheets(Array("Holidays", "Holiday Count", "Xtra's & count")).Select
Sheets("Xtra's & count").Activate
ActiveWindow.SelectedSheets.Visible = False

Sub Auto_open()
Sheets(Array("Holidays", "Holiday Count", "Xtra's & count")).Select
Sheets("Xtra's & count").Activate
ActiveWindow.SelectedSheets.Visible = True
Call Auto1
End Sub
 
S

Simon Lloyd

Hi,

I'm now using this which works but on the hide it is now only hiding
one of the two sheets any ideas why?

Sub Auto_open()
Worksheets("Holidays").Visible = True
Worksheets("Holiday Count").Visible = True
Worksheets("Xtra's & count").Visible = True
Worksheets("Front").Visible = False
Sheets("Holidays").Activate
Call Auto1
End Sub
 
S

Simon Lloyd

Sorry all!!

Sorted it!, when i added the extra sheet "front" i added it before th
array selection, once i moved it to the end it all worked fine.

Regards,

Simo
 

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