Oups !!! C'est comme à l'école : quand tu lis mal la consigne tu te plantes.une formule vba
Function TrouverDernier(Plage, C$)
tablo = Plage
For i = 1 To UBound(tablo)
If tablo(i, 1) = C Then TrouverDernier = i
Next i
End Function
=TrouverDernier(Plage de recherche;Chaine à trouver)
par exemple
=TrouverDernier(B1:B16;"x")
Sub TrouverDernierOccurence()
Chaine = "x"
tablo = Sheets("Feuil2").Range("B1:B20")
For i = 1 To UBound(tablo)
If tablo(i, 1) = Chaine Then L = i
Next i
MsgBox "Dernier " & Chaine & " trouvé en ligne " & L
End Sub
Function FindLastRow(ByVal searchValue As String) As Long
Dim lastRow As Long
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = lastRow To 1 Step -1
If Cells(i, "A").Value = searchValue Then
FindLastRow = i
Exit For
End If
Next i
End Function
Function FindLastRow(ByVal searchValue As String) As Long
FindLastRow = Cells.Find(What:=searchValue, After:=Range("A1"), _
LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
End Function