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 36 37 38 39 40 41 42 43 44 45 46 47
|
Sub test()
Dim tableau(2, 2) As Single
Dim a As Single
Dim i As Integer
Dim Col As Integer
Dim Cpt As Integer
' ici on indique la colonne du tableau sur laquelle on fait la recherche du Max
Col = 0
Cpt = 0
tableau(0, 0) = 10
tableau(0, 1) = -5
tableau(0, 2) = 4
tableau(1, 0) = 11
tableau(1, 1) = 11
tableau(1, 2) = 11
tableau(2, 0) = 11
tableau(2, 1) = 11
tableau(2, 2) = 11
For i = LBound(tableau, 2) To UBound(tableau, 2)
If Cpt = 0 Then
a = tableau(Col, i)
Else
If tableau(Col, i) > a Then
a = tableau(Col, i)
End If
End If
Cpt = Cpt + 1
Next i
Debug.Print a
End Sub |
Partager