ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hiding/Unhiding multiple sheets in VBA? (https://www.excelbanter.com/excel-programming/345526-hiding-unhiding-multiple-sheets-vba.html)

Simon Lloyd[_660_]

Hiding/Unhiding multiple sheets in VBA?
 

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


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=484793


Simon Lloyd[_661_]

Hiding/Unhiding multiple sheets in VBA?
 

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


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=484793


Simon Lloyd[_662_]

Hiding/Unhiding multiple sheets in VBA?
 

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

--
Simon Lloy
-----------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...nfo&userid=670
View this thread: http://www.excelforum.com/showthread.php?threadid=48479



All times are GMT +1. The time now is 08:29 AM.

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