Hi everyone,
I have the following code that adjusts the previous week and next 2 weeks unhidden when the workbook is opened (By the day)
The dates are displayed in Row 3 (In columns from column Q:KV)
is it possible for "complete" weeks to be shown and not, lets say from Wednesday as an example but show from Monday thru to Sunday, before todyas date and from Monday thru Sunday the follwoing 2 weeks
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 - 7 Or .Cells(3, i) > Date + 14 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 (By the day)
The dates are displayed in Row 3 (In columns from column Q:KV)
is it possible for "complete" weeks to be shown and not, lets say from Wednesday as an example but show from Monday thru to Sunday, before todyas date and from Monday thru Sunday the follwoing 2 weeks
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 - 7 Or .Cells(3, i) > Date + 14 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