I have code that loops through cells and fills the cell based on an if statement that contains the "Or" function and then the "And" function.
The code is partially working, the "Or" section is working but the "And" section is being ignored and the cells are being filled only on the basis of the "Or" section only.
Can someone help so that the code factors in the "And" function and not just the "Or" section.
Below is the code in question.
Thanks.
Sub MarkUp()
Worksheets("TO_Project").Activate
ActiveSheet.Cells(1, 24) = Date
ActiveSheet.Cells(1, 25).Value = DateAdd("d", 30, ActiveSheet.Cells(1, 24))
MarkUpLastRow = ActiveSheet.Range("f100000").End(xlUp).Row
For RowCount = 2 To MarkUpLastRow
If ActiveSheet.Cells(RowCount, 4) = "01 Prospect" Or ActiveSheet.Cells(RowCount, 4) = "02 Capture" Or ActiveSheet.Cells(RowCount, 4) = "03 Proposal" Or ActiveSheet.Cells(RowCount, 4) = "04 Submitted" And ActiveSheet.Cells(RowCount, 16) < ActiveSheet.Cells(1, 24) Then ActiveSheet.Cells(RowCount, 16).Interior.ColorIndex = 37
End If
Next RowCount
End Sub
Aucun commentaire:
Enregistrer un commentaire