billandrew
Well-known Member
- Joined
- Mar 9, 2014
- Messages
- 743
Hello all
today I am trying to highlight row if less than today
this is the code I am using.
Could someone provide some explanation
Thank You
Sub highlightrow()
Dim i As Long
Dim lastrow As Long
Dim cell As Range
lastrow = Sheets("Sheet1").Cells(Rows.Count, 1).Row
For Each cell In Range("D2:D" & lastrow)
If Cells(i, "D").Value < Date Then
Cells(i, 1).Resize(1, 5).Interior.Color = RGB(253, 249, 215)
Cells(i, 1).Resize(1, 5).Font.Bold = True
End If
Next
End Sub
today I am trying to highlight row if less than today
this is the code I am using.
Could someone provide some explanation
Thank You
Sub highlightrow()
Dim i As Long
Dim lastrow As Long
Dim cell As Range
lastrow = Sheets("Sheet1").Cells(Rows.Count, 1).Row
For Each cell In Range("D2:D" & lastrow)
If Cells(i, "D").Value < Date Then
Cells(i, 1).Resize(1, 5).Interior.Color = RGB(253, 249, 215)
Cells(i, 1).Resize(1, 5).Font.Bold = True
End If
Next
End Sub