Hiding and Unhiding Sheets
Hi Rob,
I have tried something out:
Sub HideShowAll(strSkip As String, blnShow As Boolean)
Dim sht As Worksheet
' Start error handling
On Local Error GoTo hideAll_err
' Activate the sheet that not must be hidden,
' if it does not exists an error occurs
If Not blnShow Then
Sheets(strSkip).Activate
End If
For Each sht In ThisWorkbook.Worksheets
If StrComp(sht.Name, strSkip, vbTextCompare) < 0 Then
sht.Visible = blnShow
End If
Next
' cancel error handling
On Local Error Resume Next
' Activate the wanted sheet,
' If if exists it is now visible
If blnShow Then
Sheets(strSkip).Activate
End If
Exit Sub
hideAll_err:
MsgBox "Sheet not found", vbCritical, strSkip
End Sub
You can use this separate Sub for Showing All and Hiding all but one.\
In the case ad hand you coud use
Call HideShowAll("Vendor Worksheet", False)
Hoop This Helps
Executor
|