View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default How to determine which sheets appear on opening a workbook.

I would hide the sheets before close so's if users disable macros the sheets
will be hidden.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sht As Worksheet
For Each sht In ActiveWorkbook.Sheets(Array("Sheet1", "Sheet2", "Sheet3"))
sht.Visible = xlSheetVeryHidden
Next sht
End Sub

To allow you to see all sheets and edit them.

In a general module...............

Sub UnHideAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Visible = True
Next n
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP


On Mon, 22 Mar 2010 08:08:01 -0700, Glenn
wrote:

Is it possible to determine which sheets appear when a workbook is opened. I
have a workbook with a number of hidden sheets that are updated by me from
time to time and I would like them to start off hidden when the workbook is
opened by say, someone else on the network. I have toyed with the Workbook
Open in VB but to no avail. Many thanks

Glenn