I modified your code to loop only on column D (ExpirationDate) and used the OFFSET method to determine the values in column B. I also put in a test to stop the loop if the cell in column D is blank (see the BOLD code). Try this instead:
Private Sub CommandButton2_Click()
Dim StatRng As Range
Dim myRng As Range
Dim D As Range 'Column D
Set myRng = Range("ExpirationDate")
For Each D In myRng
If D.Value < Date And D.Offset(0, -2).Value = "Active" Then
D.Offset(0, -2).Value = "Expired"
D.Offset(0, -2).Font.ColorIndex = 0
D.Offset(0, -2).Interior.ColorIndex = 45
End If
If D.Value = "" Then Exit For
Next D
End Sub
Hope this helps,
theDude
Bookmarks