D
David A.
I need to know how to do this for rows instead of columns.
I have the same issue but with rows instead.
Public Sub MyHide()
Dim rngCell As Range
Dim lngNumColumns As Long
Application.ScreenUpdating = False
lngNumColumns = ActiveSheet.UsedRange.Columns.Count
For Each rngCell In Range("A3").Resize(1, lngNumColumns)
With rngCell
.EntireColumn.Hidden = (.Value = 1)
End With
Next rngCell
Application.ScreenUpdating = True
End Sub
I have the same issue but with rows instead.
Public Sub MyHide()
Dim rngCell As Range
Dim lngNumColumns As Long
Application.ScreenUpdating = False
lngNumColumns = ActiveSheet.UsedRange.Columns.Count
For Each rngCell In Range("A3").Resize(1, lngNumColumns)
With rngCell
.EntireColumn.Hidden = (.Value = 1)
End With
Next rngCell
Application.ScreenUpdating = True
End Sub