Apr 11 2022 05:56 AM
Hello,
I would like to change the background colour if the date says it is weekend.
I now have this:
It works but for a bit, I would like that only the weekends are highlighted.
And that it would stop when there is no more string/text found at A.
Right now I use this code
Dim r As Range, c As Range
Set r = Range(Range("G2"), Range("NG2").End(xlDown))
For Each c In r
If Weekday(c) = 6 Or Weekday(c) = 7 Then
c.Interior.ColorIndex = 3
End If
Next c
What can I do to make it work?
Apr 11 2022 06:25 AM
Solution@GKE2019 No need for a macro. Use Conditional Formatting in stead.
Select the range you want to affect , including the date header. On the Home ribbon, select Conditional formatting. Add a new rule using a formula like this:
=WEEKDAY(B$2)>=6
Where B2 is the first date in the top left corner (see picture).
Apr 11 2022 06:25 AM
Solution@GKE2019 No need for a macro. Use Conditional Formatting in stead.
Select the range you want to affect , including the date header. On the Home ribbon, select Conditional formatting. Add a new rule using a formula like this:
=WEEKDAY(B$2)>=6
Where B2 is the first date in the top left corner (see picture).