It runs but it does not do what it is supposed to do. What I need:
If cell B contains "RR", and if C does not equal memo or correction and cell G is not air or printed then change L to 0.
If cell B contains "RR", and if C does not equal memo or correction and cell G is air or printed then change L to H*.1.
Sub RRCLEAN()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim myString As String
With ActiveSheet
RowCount = WorksheetFunction.CountA(range("A:A"))
For i = 2 To RowCount
myString = Trim(Cells(i, 2).Value)
If InStr(myString, "RR") > 0 And .Cells(i, 3).Value <> "Memo" And .Cells(i, 3).Value <> "Correction" And .Cells(i, 7).Value <> "Air" Or .Cells(i, 7).Value <> "Printed" Then
Cells(i, 12).Value = 0
End If
Next
For i = 2 To RowCount
myString = Trim(Cells(i, 2).Value)
If InStr(myString, "RR") > 0 And .Cells(i, 3).Value <> "Memo" And .Cells(i, 3).Value <> "Correction" And .Cells(i, 7).Value = "Air" Or .Cells(i, 7).Value = "Printed" Then
Cells(i, 12).Value = Cells(i, 8).Value * 0.1
End If
Next
End With
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Aucun commentaire:
Enregistrer un commentaire