Hiding and Unhiding Worksheets
Maybe...
Option Explicit
sub testme()
Dim sh as worksheet
worksheets("Merchant").visible = xlsheetvisible
worksheets("vendor").visible = xlsheetvisible
Worksheets("procurement").visible = xlsheetvisible
for each sh in activeworkbook.worksheets
select case lcase(sh.name)
case is = "merchant","vendor","procurement"
'do nothing
case else
sh.visible = xlsheethidden
end select
next sh
end sub
Rob wrote:
Also, I can't name the Worksheets because at times the names will be
different as I continue creating this tool. So basically what I want to do
is to say hide all worksheets except Vendor Worksheet or Merchant Worksheet
or Vendor Worksheet and Procurement Worksheet! Thanks Again
"Tom Ogilvy" wrote:
You can't hide all, since at least one worksheet needs to be visible all the
time.
Dim sh as worksheet
list = Array(1,5,8,9,10)
for i =lbound(list) to ubound(list)
set sh = Nothing
On Error Resume Next
set sh = worksheets(list(i))
On Error goto 0
if not sh is nothing then
sh.Visible = xlSheetVisible
Next
--
REgards,
Tom Ogilvy
"Rob" wrote in message
...
How do I hide any worksheets that are hidden. In some of my macros, I am
creating worksheets in a workbook but at certain instances all of these
worksheets may not be created and others may. I want to just specify
unhide
all or hide all.
--
Dave Peterson
|