I need help with my if statements. In the code show below: The first if ... then section works just as intended, however the second section creates a run time error "13". Can someone please explain me how to fix this issue? / what i'm doing wrong?
Sub ASN_BaaN3()
Dim i As Integer
i = 0
ThisWorkbook.Sheets("BaaN").Activate
Do While ThisWorkbook.Sheets("BaaN").Cells(2 + i, 1) <> ""
'CHECK NON SERIALIZED
If Range("J" & 2 + i).Value = "N" Then
Range("P" & 2 + i).Value = "Ok, Non Serialized"
Range("P" & 2 + i).EntireRow.Interior.Color = RGB(198, 239, 206)
End If
If Range("J" & 2 + i).Value = "Y" And _
Range("M" & 2 + i).Value = "ACK" And _
Range("o" & 2 + i).Value = "TRUE" Then
Range("P" & 2 + i).Value = "Ok, Non Serialized"
Range("P" & 2 + i).EntireRow.Interior.Color = RGB(198, 239, 206)
End If
i = i + 1
Loop
End Sub
when typing the code like this i get the same error:
If Range("J" & 2 + i).Value = "Y" Then
If Range("M" & 2 + i).Value = "ACK" Then
If Range("O" & 2 + i).Value = "TRUE" Then
Range("P" & 2 + i).Value = "Ok, Non Serialized"
Range("P" & 2 + i).EntireRow.Interior.Color = RGB(198, 239, 206)
End If
End If
End If
Also when typing the code like this
If Range("J" & 2 + i).Value = "Y" Then
If Range("M" & 2 + i).Value = "Y" Then
Please help!
Aucun commentaire:
Enregistrer un commentaire