Hide and/or Unhide Worksheets
I would do it simply that hide all sheets, then unhide only the one(s) you
want to, so no if statement needed in the for loop. Just hide 'em all then
unhide the desired.
Before that hiding or unhiding the first time I would add:
application.screenupdating = false
And then after the changes have been made
application.screenupdating = true. That way the user doesn't see worksheets
disappearing and reappearing, just a flash from where they are to where they
are going.
"PCLIVE" wrote:
One way to hide all except "Vendor".
Sub HideAllExceptVendor()
Sheets("Vendor").Visible=True
For i = 1 To Worksheets.Count
If Sheets(i).Name < "Vendor" Then
Sheets(i).Visible = False
End If
Next
End Sub
To Hide all except "Vendor" and "Merchant"
Sub HideAllExceptVendorAndMerchant()
Sheets("Vendor").Visible = True
Sheets("Merchant").Visible = True
For i = 1 To Worksheets.Count
If Sheets(i).Name < "Vendor" Then
If Sheets(i).Name < "Merchant" Then
Sheets(i).Visible = False
End If
End If
Next
End Sub
HTH,
Paul
"Rob" wrote in message
...
I want to unhide the Vendor Worksheet only
(In this case it could be a Merchant Worksheet, Or a Procurement
Worksheet)
I don't want to specify names of other worksheets that need to be hidden
for
some may not be created as yet. I want to specify one sheet to be visible
in
separate macros. So one macro would say unhide the Vendor Worksheet and
hide
the rest. Another might say unhide the Merchant Worksheet and the Vendor
Worksheet and hide the rest.
|