1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Sub TrouverValeur()
Dim ws As Worksheet
Dim dernierLigne As Long
Dim i As Long
Dim prenomCherche As String
Dim nomCherche As String
Set ws = ThisWorkbook.Sheets("CLASSEMENT")
dernierLigne = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row
prenomCherche = ws.Range("I2").Value
nomCherche = ws.Range("J2").Value
For i = 2 To dernierLigne
If ws.Cells(i, 2).Value = prenomCherche And ws.Cells(i, 3).Value = nomCherche Then
ws.Range("K2").Value = ws.Cells(i, 1).Value
Exit Sub
End If
Next i
ws.Range("K2").Value = "Non trouvé"
End Sub |