Hello there,
I have this code and it doesn't work when for instance its starts at row 6 but cells 6,7,8,9 are empty the code won't work and won't cycle through the rest of them.
Is there a way to fix this?
Private Sub Worksheet_Activate()
Dim rowNumber As Long
Dim thisSheet As Worksheet
Dim cellToCheck As Range
Dim LLName As String
Dim LFName As String
Dim LTitle As String
Dim LResponse As Integer
Set thisSheet = ActiveSheet
rowNumber = 6
Do Until thisSheet.Cells(rowNumber, 14).Value = vbNullString
Set cellToCheck = thisSheet.Cells(rowNumber, 14)
If cellToCheck.Interior.ColorIndex = xlColorIndexNone Then
If cellToCheck.Value = DateAdd("d", -1, Date) Then
LTitle = Sheets("Sheet1").Range("D" & rowNumber).Value
LFName = Sheets("Sheet1").Range("E" & rowNumber).Value
LLName = Sheets("Sheet1").Range("F" & rowNumber).Value
LResponse = MsgBox("Did " & LTitle & " " & LFName & " " & LLName & " pass their course yesterday?", vbYesNoCancel, "Course")
If LResponse = vbYes Then
cellToCheck.Interior.Color = RGB(0, 255, 0)
End If
If LResponse = vbNo Then
cellToCheck.Interior.Color = RGB(255, 0, 0)
End If
If LResponse = vbCancel Then
Exit Sub
End If
End If
End If
rowNumber = rowNumber + 1
Loop
End Sub
KJD
Bookmarks