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
|
Public Tbl1() As Variant, Tbl2() As Variant
Sub ChargerMatriceTbl1()
ReDim Tbl1(2, 1)
Tbl1(0, 0) = 5
Tbl1(1, 0) = 2
Tbl1(2, 0) = 4
Tbl1(0, 1) = 3
Tbl1(1, 1) = 4
Tbl1(2, 1) = 1
End Sub
Sub ChargeTbl2()
Dim I As Integer, J As Integer, IndexMatrice As Integer, MinColonne As Integer
ChargerMatriceTbl1
IndexMatrice = 0
For I = LBound(Tbl1, 2) To UBound(Tbl1, 2) ' To d_ligne
MinColonne = 10000
ReDim Preserve Tbl2(1, IndexMatrice)
Tbl2(0, IndexMatrice) = I
For J = LBound(Tbl1, 1) To UBound(Tbl1, 1)
If Tbl1(J, I) < MinColonne Then
MinColonne = Tbl1(J, I)
'Debug.Print "I : " & I & ", " & J
Tbl2(1, IndexMatrice) = J
End If
Next J
IndexMatrice = IndexMatrice + 1
Next I
For IndexMatrice = LBound(Tbl2, 2) To UBound(Tbl2, 2)
Debug.Print "Ligne : " & Tbl2(0, IndexMatrice) + 1 & ", colonne : " & Tbl2(1, IndexMatrice) + 1
Next IndexMatrice
End Sub |
Partager