View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Hide/Show some worksheets

Option Explicit
Sub testme()
Dim sh As Object

'make sure that there's always one sheet visible first
Worksheets("Current status").Visible = xlSheetVisible

For Each sh In ActiveWorkbook.Sheets
If LCase(sh.Name) = LCase("current status") Then
'skip it
Else
If LCase(sh.Name) Like LCase("wk*") Then
sh.Visible = xlSheetHidden
End If
End If
Next sh
End Sub



Tony S. wrote:

Is there a way to use VB code to hide/show a group of worksheets at once,
possibly using a wildcard? I have a worksheet that contains many sheets that
need to be Veryhidden or Visible easily without having to go
thru the Format/Sheet/Hide menu. Each worksheet is named for a week of the
year. (i.e. "(Wk 1) 12-1-2008", "(Wk 2) 12-8-2008", "(Wk 3) 12-15-2008"
etc). The
current week named "Current Status" will always be visible. Idealy if a
wildcard for any worksheet containing "Wk" could be used would work great.
Thanks!


--

Dave Peterson