KyleJackMorrison
Board Regular
- Joined
- Dec 3, 2013
- Messages
- 107
- Office Version
- 365
- 2021
- 2019
- Platform
- Windows
Hey,
So here is my code and i require it to offset select cells to the left until J23 and to the right until NO23.
In theory, if the cell X23 contained today's date. All columns to the right get hidden until column 'NO' and all columns to the left get hidden until J23.
So here is my code and i require it to offset select cells to the left until J23 and to the right until NO23.
Code:
Sub hideme()
Sheets("Settings").Visible = True
Sheets("Main").Select
For Each cell In ActiveSheet.Range("J23:NO23")
If cell.Value = [Today()] Then
cell.Select
End If
Next
Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(0, [U]NO23[/U])).EntireColumn.Hidden = True
Range(ActiveCell.Offset(0, -1), ActiveCell.Offset(0, [U]J23[/U])).EntireColumn.Hidden = True
'do something
End Sub
In theory, if the cell X23 contained today's date. All columns to the right get hidden until column 'NO' and all columns to the left get hidden until J23.
Last edited: