Hi,
I'm trying to make a spreasheet where if there is a "0" on the first sheet, it will hide a corresponding sheet. For example, if B2 has a "0", then Sheet2 will be hidden and same thing until B18 and Sheet18. I have this code right now that works for one sheet:
Private Sub Worksheet_Change(ByVal Target As Range)
If [B2] = "0" Then
Sheets ("Sheet2").Visible = False
Else
Sheets("Sheet2").Visible = True
End If
End Sub
Is there a way to modify this to apply to multiple sheets and cells rather than just one of each?
Thanks
I'm trying to make a spreasheet where if there is a "0" on the first sheet, it will hide a corresponding sheet. For example, if B2 has a "0", then Sheet2 will be hidden and same thing until B18 and Sheet18. I have this code right now that works for one sheet:
Private Sub Worksheet_Change(ByVal Target As Range)
If [B2] = "0" Then
Sheets ("Sheet2").Visible = False
Else
Sheets("Sheet2").Visible = True
End If
End Sub
Is there a way to modify this to apply to multiple sheets and cells rather than just one of each?
Thanks