Retroshift
Board Regular
- Joined
- Sep 20, 2016
- Messages
- 119
- Office Version
- 2019
- Platform
- Windows
Hello, I got a macro button which adds month sheets for a specific year that is entered in an inputbox.
The following code unsuccessfully attempts to fill all working days with a pink colour if they match a range of cells that represent the holidays (and include blank cells).
Is there a way to make the code work?
The following code unsuccessfully attempts to fill all working days with a pink colour if they match a range of cells that represent the holidays (and include blank cells).
Is there a way to make the code work?
VBA Code:
For Each rng In Range("B1").Resize(2, Day(DateSerial(yr, i + 1, 1) - 1))
datearray = Application.Transpose(Worksheets("Holidays").Range("C8:C42")) 'includes blank cells
If Weekday(rng) > 1 And Weekday(rng) < 7 And Filter(datearray, CLng(rng), , vbTextCompare) Then
rng.Interior.Color = RGB(255, 204, 255)
End If
Next