Hide a sheet with a variable name
hi, Scott !
Thanks for the code it works quite well.
I extended and moved the range from B3:B4 to A3:A10 and it still worked fine.
However it (un)hides all the sheets in the range.
What I need to do is be able to show/hide individual sheets (names in range A3:A10)
depnding on whether or not the corresonponing target cell in range B3:10 has an entry?
ie if B7 is a null value (which is the default) then hide the sheet name, based on A7
perhaps...
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myCell As Range
Application.ScreenUpdating = False
If Intersect(Target, Range("b3:b10")) Is Nothing Then Exit Sub
For Each myCell In Intersect(Target, Range("b3:b10"))
Worksheets(myCell.Offset(, -1).Text).Visible = myCell < ""
Next
End Sub
hth,
hector.
|