VBA - Fonction IsArray

La fonction IsArray renvoie une valeur booléenne qui indique si la variable d'entrée spécifiée est une variable de tableau.

Syntaxe

IsArray(variablename)

Exemple

Ajoutez un bouton et ajoutez la fonction suivante.

Private Sub Constant_demo_Click()
   Dim a,b as Variant
   a = array("Red","Blue","Yellow")
   b = "12345"
  
   msgbox("The IsArray result 1 : " & IsArray(a))
   msgbox("The IsArray result 2 : " & IsArray(b))
End Sub

Lorsque vous exécutez la fonction ci-dessus, elle produit la sortie suivante.

The IsArray result 1 : True
The IsArray result 2 : False