1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| Sub chercher_max()
Dim i As Long
Dim j As Long
Dim der_ligne As Long
Dim valeur1 As Long
Dim valeur2 As Long
Dim n As Integer
With Sheets("Feuil1") 'Adapte au nom de ta feuille
der_ligne = .Cells(Rows.Count, 1).End(xlUp).Row
j = 1 'Adapte ce nombre en fonction de la ligne ou commence ta recherche
valeur2 = .Cells(j, 1)
For i = 1 To der_ligne ' modifie le 1 en fonction de la ligne ou commence ta recherche
If Left(.Cells(i, 1), 1) = "<" Or Left(.Cells(i, 1), 1) = ">" Then
n = Len(.Cells(i, 1))
valeur1 = Right(.Cells(i, 1), n - 1)
Else
valeur1 = .Cells(i, 1)
End If
If valeur1 > valeur2 Then
j = i
valeur2 = valeur1
End If
Next i
MsgBox ("La plus grande valeur de la colonne 1 est : " & .Cells(j, 1) & vbNewLine & " Elle se trouve ligne " & j)
End With
End Sub |
Partager