I'm looking at trying to speed up my nested If statement below if possible since it goes through each row in my column. This has an impact on the run time of my macro:
Set Col = Range("O2:O" & lastrowOU3)
For Each Cell In Col
If Cell.Offset(0, -2) = 0 And Cell.Offset(0, -1) = 0 Then Cell.Value = "NEW ITEM"
If Cell.Offset(0, -2) = 0 And Cell.Offset(0, -1) = "NEW ITEM" Then Cell.Value = "NOT VALIDATED"
If Cell.Offset(0, -2) < Date And Cell.Offset(0, -1) = "NEW ITEM" Then Cell.Value = "NOT VALIDATED"
If Cell.Offset(0, -2) < Date And Cell.Offset(0, -1) = "VALIDATED" Then Cell.Value = "NOT VALIDATED"
If Cell.Offset(0, -2) < Date And Cell.Offset(0, -1) = "NOT VALIDATED" Then Cell.Value = "NOT VALIDATED 1"
If Cell.Offset(0, -2) < Date And Cell.Offset(0, -1) = "NOT VALIDATED 1" Then Cell.Value = "NOT VALIDATED 2"
If Cell.Offset(0, -2) >= Date Then Cell.Value = "VALIDATED"
Next
Is there a way of avoiding going through each scenario once one of the above is met so macro goes straight to next row? Or perhaps theres an even quicker way?
Thanks,
Conor
Aucun commentaire:
Enregistrer un commentaire