Sub testy1()
Dim Liste As Variant
Liste = Application.Transpose(Array(1, 2, 3, 4, 5, 6))
MsgBox WhatIsIt(Liste)
End Sub
Sub testy2()
Dim Liste(1 To 50, 1 To 10) As Variant
MsgBox WhatIsIt(Liste)
End Sub
Sub testy3()
Dim Liste As Variant
Set Liste = [A1:A13]
MsgBox WhatIsIt(Liste)
End Sub
Sub testy4()
Dim Liste As Variant
Set Liste = [A1:H1]
MsgBox WhatIsIt(Liste)
End Sub
Sub testy5()
Dim Liste As Variant
Liste = "1,2,3,4,5,6,7,8,9"
MsgBox WhatIsIt(Liste)
End Sub
Sub testy6()
Dim Liste As Variant
Liste = 12.36
MsgBox WhatIsIt(Liste)
End Sub
Sub testy7()
a = [A1:H1].Value
MsgBox WhatIsIt(a)
End Sub
Sub testy8()
a = Application.Transpose(Array(1, 2, 3, 4, 5, 6, 7, 8, 9))
MsgBox WhatIsIt(a)
End Sub
Sub testy9()
Dim a(0 To 5, 1)
a(5, 0) = "toto "
MsgBox WhatIsIt(a)
End Sub
Sub testy10() ' erreur donne vrai quand base 0
Dim a(0 To 5, 0)
a(5, 0) = "toto "
MsgBox WhatIsIt(a)
End Sub
Function WhatIsIt(ByVal a As Variant)
Dim b()
If TypeName(a) = "Range" Then a = a.Value
If IsArray(a) Then
WhatIsIt = "Array 2 dimensions, Colonnes : " & UBound(a, 2) + 1 - LBound(a, 2) & " ,Lignes : " & UBound(a, 1) + 1 - LBound(a, 1)
Else
If TypeName(a) <> "Variant()" Then WhatIsIt = TypeName(a)
End If
End Function