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
|
Option Explicit
Public tab_exemple() As Variant
Sub Testtab_varA()
Dim I As Long
tab_varA
For I = LBound(tab_exemple, 2) To UBound(tab_exemple, 2)
Debug.Print tab_exemple(0, I) & ", " & tab_exemple(1, I)
Next I
End Sub
Sub tab_varA()
'Déclaration
Dim Dern_ligne As Long, Dern_col As Long, I As Long, J As Long
Erase tab_exemple
'définition des limites du tableau
With Feuil1
Dern_ligne = .Cells(.Rows.Count, 1).End(xlUp).Row
Dern_col = .Cells(1, .Columns.Count).End(xlToLeft).Column
'Enregistrement des valeurs dans le tableau
For I = 0 To Dern_ligne - 1
ReDim Preserve tab_exemple(Dern_col - 1, I)
For J = 0 To Dern_col - 1
tab_exemple(J, I) = .Cells(I + 1, J + 1)
Next J
Next I
End With
End Sub |
Partager