I'm trying to get the code to check if multiple conditions are true and if so, to then change the colour of the cell but this doesn't work and highlights way more than necessary. I'm not sure why the code doesn't work as intended:
Sub ConditionCheck()
Dim wb As Workbook
Dim ws As Worksheet
Dim lastrow As Long
Dim rng1 As Range
Dim rng2 As Range
Dim c As Range
Dim d As Range
Set wb = ActiveWorkbook
Set ws = wb.Sheets("Source")
lastrow = Sheets("Source").Cells(Rows.Count, "A").End(xlUp).Row
i = 2
For i = 2 To lastrow
If Cells(i, 8) = "Cancelled Not Applicable" Or Cells(i, 8) = "Completed" Or Cells(i, 8) <> "" Then
If Cells(i, 23) <> "Cancelled" Or Cells(i, 23) <> "Completed" Then
Cells(i, 23).Interior.ColorIndex = 4
End If
End If
Next i
End Sub
Aucun commentaire:
Enregistrer un commentaire