Hi Guru's
I have a Drop Down List via Data Validation in Cell B1
The list consists of a Date range by month
I would like that every time this drop down is changed to another month that it will call a hidden column sub. But since its only in that one worksheet
the code below only needs to ref "Stations" as a ws. Any Help would be great! Thanks in advance.
I have a Drop Down List via Data Validation in Cell B1
The list consists of a Date range by month
I would like that every time this drop down is changed to another month that it will call a hidden column sub. But since its only in that one worksheet
the code below only needs to ref "Stations" as a ws. Any Help would be great! Thanks in advance.
VBA Code:
Sub Hide_Columns_Via_CoverPage()
' Hides Columns that are not within the Period
Application.ScreenUpdating = True
Dim ws As Variant, Xrow As Long, LCol As Long
For Each ws In Worksheets(Array("Stations", "Commercial", "Call Center", "HR", "Balance Sheet", "Cash Flow Statement"))
Xrow = 5
LCol = ws.Cells(5, Columns.Count).End(xlToLeft).Column
With ws
For x = 1 To LCol
If ws.Cells(Xrow, x) <> "X" Then
ws.Columns(x).Hidden = True
Else
ws.Columns(x).Hidden = False
End If
Next x
End With
Next ws
Application.ScreenUpdating = False
End Sub
Last edited by a moderator: