Bonjour à tous.
Je suis entrain de coder pour comparer deux listes pour effectuer un tri par la suite.
Voici mon code :
Sub testtri()
Dim i, a As Object, b, numeroligne, rep1, rep2, rep3
For i = 1 To Sheets(3).Range("B" & Rows.Count).End(xlUp).Row
b = Sheets(3).Cells(i, 2).Value
Set a = Sheets(4).Range("B:B").Find(b)
numeroligne = a.Row 'PROBLEME'
If a Is Nothing Then
rep1 = MsgBox("Nouvelle NCN", vbOKOnly + vbExclamation, "Alerte")
If rep1 = vbOK Then
rep2 = MsgBox(Sheets(3).Cells(i, 2).Value, vbOKOnly, "La nouvelle NCN est la : ")
If rep2 = vbOK Then
Sheets(3).Rows(i).Interior.ThemeColor = xlThemeColorAccent3
End If
End If
ElseIf Sheets(3).Cells(i, 11).Value <> Sheets(4).Cells(numeroligne, 11).Value Then
rep3 = MsgBox(Sheets(3).Cells(i, 2).Value, vbOKOnly + vbExclamation, "NCN fermée : ")
End If
Next i
End Sub
Le problème c'edt qu'au niveau de la ligne 'PROBLEME', on me détecte une erreur 91.
Pourriez-vous m'aider ?
Merci à vous.
Cordialement
AlexisAz