anand3dinesh
Board Regular
- Joined
- Dec 19, 2019
- Messages
- 137
- Office Version
- 365
- Platform
- Windows
Hi Excel Experts,
i have this code to highlight holidays in my daily tracker. when i run this code it highlights wrong rows also wrong cells.
Please check my code below. also image attached to show what cells exactly code is highlighting when i run this.
Many Thanks.
Sub holidays()
Dim i As Long
Dim lstrow As Long
lstrow = Range("B100").End(xlUp).Row
For i = 1 To lstrow
On Error Resume Next
Cells(i, 3).Find("Saturday").Range("A" & i & ":" & "E" & i).Interior.Color = RGB(248, 203, 173)
Cells(i, 3).Find("Sunday").Range("A" & i & ":" & "E" & i).Interior.Color = RGB(248, 203, 173)
Next i
End Sub
i have this code to highlight holidays in my daily tracker. when i run this code it highlights wrong rows also wrong cells.
Please check my code below. also image attached to show what cells exactly code is highlighting when i run this.
Many Thanks.
Sub holidays()
Dim i As Long
Dim lstrow As Long
lstrow = Range("B100").End(xlUp).Row
For i = 1 To lstrow
On Error Resume Next
Cells(i, 3).Find("Saturday").Range("A" & i & ":" & "E" & i).Interior.Color = RGB(248, 203, 173)
Cells(i, 3).Find("Sunday").Range("A" & i & ":" & "E" & i).Interior.Color = RGB(248, 203, 173)
Next i
End Sub
Attachments
Last edited: