Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave, as usual, you're a genius. Your code does exactly what I wanted.
Thank you sir. "Dave Peterson" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Show/Hide | Excel Discussion (Misc queries) | |||
show hide row if | Excel Discussion (Misc queries) | |||
Hide/Show some worksheets | Excel Discussion (Misc queries) | |||
Hide and show a group of worksheets | Excel Programming | |||
Hide and show | Excel Programming |