Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

transposer un tableau

1 réponse
Avatar
isabelle
bonjour à tous,

peut t'on transposer un tableau comme celui-ci
Dim list(0 To 20, 0 To 10, 0 To 3)

merci!
isabelle

1 réponse

Avatar
JB
Bonjour,

Sub TableauxEmboites()
Dim a(1 To 3, 1 To 2) ' 2D
Dim b(1 To 3, 1 To 2) ' 2D
For i = 1 To 3
a(i, 1) = i
b(i, 1) = i * 2
a(i, 2) = i * 3
b(i, 2) = i * 4
Next i
tbl = Array(a, b) ' 3 dimensions
For lig = 0 To 1
For j = 1 To 3
For k = 1 To 2
MsgBox tbl(lig)(j, k)
Next k
Next j
Next lig
End Sub

Sub TableauxEmboites2()
Dim a(1 To 3, 1 To 2) ' 2D
Dim b(1 To 3, 1 To 2) ' 2D
For i = 1 To 3
a(i, 1) = i
a(i, 2) = i * 3
b(i, 1) = i * 2
b(i, 2) = i * 4
Next i
tbl = Array(a, b) ' 3 dimensions
d = tbl(0) ' d() 2 dimensions
MsgBox UBound(d, 1)
MsgBox UBound(d, 2)
e = tbl(1) ' e() 2 dimensions
MsgBox UBound(e, 1)
MsgBox UBound(e, 2)
[A1:B3] = d
[D1:F2] = Application.Transpose(e)
End Sub

JB


On 23 avr, 03:59, isabelle wrote:
bonjour à tous,

peut t'on transposer un tableau comme celui-ci
Dim list(0 To 20, 0 To 10, 0 To 3)

merci!
isabelle