In my table I have the date in the format "dddd , mmmm dd, yyyy". So for example "Sunday ,July 05,2020". I want the macro to format cells that have the word "Sunday" in and can't get it to work. I can change it to the dd string (ie 17) or the yyyy string (ie 2020) and it works, but not the dddd or mmmm strings which contain text.
Sub colour()
Dim rng As range
Dim lastRow As Long
Dim cell As range
lastRow = Cells(Rows.Count, 3).End(xlUp).Row
Set rng = range("J2:J" & lastRow)
For Each cell In rng
'If I change "Sunday" to "17" for example, or "2020", the routine works, but I cannot get it to find
'the dddd string
If InStr(cell.Value, "Sunday") > 0 Then
range(cell.Address).Interior.ColorIndex = 19
Else
range(cell.Address).Interior.ColorIndex = 0
End If
Next cell
End Sub