mits3kgtvr4
New Member
- Joined
- Dec 23, 2020
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
Hi all. I have a spreadsheet with a column for each day in 2021. I am wanting to automatically hide all columns from that range that is NOT the current day. I found some VBA code online but none really met my need. The one that seem to best fit my situation bugged out on me in row 4. This is it below. The only difference I was not to just hide values lower than mine, but all of them except K4. Any help would be appreciated.
TIA!
TIA!
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Updateby Extendoffice
Dim xCell As Range
If Target.Address <> Range("K4").Address Then Exit Sub
Application.ScreenUpdating = False
For Each xCell In Range("A1:I1")
xCell.EntireColumn.Hidden = (xCell.Value < Target.Value)
Next
Application.ScreenUpdating = True
End Sub