Hi all,
Could you please assist me in adding multiple hide columns to this code that uses a cell value to control columns on another worksheet
I have multiple cell values ranging from B8 to B20 (there are also gaps in between) and each cell value controls two columns.
I'd like it so that if any of them are zero/blank, that the connected two columns are hidden. The code above works for one but I dont know how to add more.. It was put into the sheets code
Would greatly appreciate some help
Could you please assist me in adding multiple hide columns to this code that uses a cell value to control columns on another worksheet
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Dim Value As Range, Cells As Range, Cell As Variant
If Not Intersect(Target, Range("$B$8")).Value = 0 Then
Sheets("Sheet1").Columns("D:E").EntireColumn.Hidden = False
Else
Sheets("Sheet1").Columns("D:E").EntireColumn.Hidden = True
End If
End Sub
I have multiple cell values ranging from B8 to B20 (there are also gaps in between) and each cell value controls two columns.
I'd like it so that if any of them are zero/blank, that the connected two columns are hidden. The code above works for one but I dont know how to add more.. It was put into the sheets code
Would greatly appreciate some help