Hello. I am new to manipulating excel via VBA. I am trying to conditionally hide an entire coloumn based on a cell result in the given column. I have gotten only the below code to work.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("B3").Value = 0 Then
Columns("B").EntireColumn.Hidden = True
Else
Columns("B").EntireColumn.Hidden = False
End If
End Sub
I can get this to hide coloumn B as I want, but it only works for coloumn B (obviously). I want it to work for a range of coloumns from B to BA such that B3=0-->hide colB , C3=""-->display col C , D3=0-->hide colD , ... etc. up to coloumn BA
I'm assuming the answer is as simple as nesting the above code in a while loop or something similar from B:BA, but I don't have the know-how to program such a macro.
Thanks in Advance!
Bookmarks