Needtoknow
Board Regular
- Joined
- Apr 21, 2006
- Messages
- 73
Hi,
I'm trying to Hide Columns based on the date in each column but only show the past 30 days. Going across the spreadsheet, I have the date in row D (starting at row D16, E16, .........AKY16).
When the user opens the file and selects the macro button, I want it to only show the columns for the past 30 days. I'm stuck.... is there an easier way?
Sub HideColumnsBasedOnDate()
Dim r As Range, c As Range
Application.ScreenUpdating = False
For Each c In r
If Range("D16").Value > Today Then
r.EntireColumn.Hidden = True
Else
r.EntireColumn.Hidden = False
End If
Next c
Application.ScreenUpdating = True
End Sub
I'm trying to Hide Columns based on the date in each column but only show the past 30 days. Going across the spreadsheet, I have the date in row D (starting at row D16, E16, .........AKY16).
When the user opens the file and selects the macro button, I want it to only show the columns for the past 30 days. I'm stuck.... is there an easier way?
Sub HideColumnsBasedOnDate()
Dim r As Range, c As Range
Application.ScreenUpdating = False
For Each c In r
If Range("D16").Value > Today Then
r.EntireColumn.Hidden = True
Else
r.EntireColumn.Hidden = False
End If
Next c
Application.ScreenUpdating = True
End Sub