I have created a workbook and pre-filled some columns with data but want it hidden unless it hits the year it numbered as.
i have row 2 as the headers with the dates (albeit merged) and row 4 = row 2 dates (in each cell rather than a merged cell) for each column (un-merged)
I have hidden columns H:AM
on workbook open if those columns are older than todays date i want to unhide them.
i currently use this below but get "xCell.Value=empty" causing the vba to break. what am i doing wrong?
i have row 2 as the headers with the dates (albeit merged) and row 4 = row 2 dates (in each cell rather than a merged cell) for each column (un-merged)
I have hidden columns H:AM
on workbook open if those columns are older than todays date i want to unhide them.
i currently use this below but get "xCell.Value=empty" causing the vba to break. what am i doing wrong?
VBA Code:
Private Sub Workbook_Open()
Dim xCell As Range
For Each xCell In Range("H4:AM4")
If xCell.Value < Date Then
xCell.EntireColumn.Show = True
End If
Next
End Sub