Hi everyone,
I have the following code that adjusts the previous week and next 2 weeks unhidden when the workbook is opened
The dates are displayed in Row 3 (In columns from column Q:KV)
What i would like is for the display of weekends (Currently only displays weekdays)
Private Sub Workbook_Open()
Dim i As Long
With Worksheets("Live Service Orders")
.Cells.EntireColumn.Hidden = False
For i = 17 To .Cells(3, Columns.Count).End(xlToLeft).Column
If .Cells(3, i).Value < Date - 14 Or .Cells(3, i) > Date + 42 Then
.Columns(i).Hidden = True
ElseIf Weekday(.Cells(3, i), 2) > 5 Then
.Columns(i).Hidden = True
End If
Next
End With
End Sub
Many thanks for any help
I have the following code that adjusts the previous week and next 2 weeks unhidden when the workbook is opened
The dates are displayed in Row 3 (In columns from column Q:KV)
What i would like is for the display of weekends (Currently only displays weekdays)
Private Sub Workbook_Open()
Dim i As Long
With Worksheets("Live Service Orders")
.Cells.EntireColumn.Hidden = False
For i = 17 To .Cells(3, Columns.Count).End(xlToLeft).Column
If .Cells(3, i).Value < Date - 14 Or .Cells(3, i) > Date + 42 Then
.Columns(i).Hidden = True
ElseIf Weekday(.Cells(3, i), 2) > 5 Then
.Columns(i).Hidden = True
End If
Next
End With
End Sub
Many thanks for any help