Macro to hide worksheet based upon text in the name
Hi,
This will hide all worksheets with Hold anywhere in the name
Sub Hide_shts()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If InStr(1, ws.Name, "Hold", vbTextCompare) Then
ws.Visible = False
End If
Next
End Sub
--
Mike
When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
"Joe M." wrote:
Is it possible to have a macro that hides worksheets based upon text
contained or not contained in the worksheet name? Suppose i have several
worksheets but want to hide ony the ones that don't have the text "HOLD" in
the name;
worksheet names:
Data_HOLD
Data Selection_HOLD
etc....
or maybe base it upon the WS tab color....
Thanks,
Joe M.
|