Table des matières
UBound Description
Renvoie l'indice le plus élevé pour une dimension d'un tableau.
Exemples UBound simples
1234 | Sous UBound_Example()Dim a (3 à 10) en tant qu'entierMsgBox UBound(a)Fin du sous-marin |
Résultat : 10
Syntaxe UBound
1 | UBound(ArrayName, [ Dimension ]) |
La fonction UBound contient 2 arguments :
Nom du tableau : Nom de la variable de type tableau.
Dimension: [Facultatif] Entier indiquant la limite inférieure de la dimension renvoyée. Utilisez 1 pour la première dimension, 2 pour la seconde, etc. 1 si omis.
Exemples de fonction Excel VBA UBound
1234567 | Sous UBound_Example1()Dim arrValue (1 à 5, 4 à 8, 12 à 25)MsgBox UBound(arrValue)MsgBox UBound(arrValue, 1)MsgBox UBound(arrValue, 2)MsgBox UBound(arrValue, 3)Fin du sous-marin |
Résultat : 5, 5, 8, 25
Description de la borne L
Renvoie l'indice le plus bas pour une dimension d'un tableau.
Exemples de LBound simples
1234 | Sous-LBound_Example()Dim a (3 à 10) en tant qu'entierMsgBox LBound(a)Fin du sous-marin |
Résultat : 3
Syntaxe LBound
1 | LBound(Nom du tableau, [ Dimension ]) |
La fonction LBound contient 2 arguments :
Nom du tableau : Nom de la variable de type tableau.
Dimension: [Facultatif] Entier indiquant la limite inférieure de la dimension renvoyée. Utilisez 1 pour la première dimension, 2 pour la seconde, etc. 1 si omis.
Exemples de fonction Excel VBA LBound
1234567 | Sous-LBound_Example1()Dim arrValue (1 à 5, 4 à 8, 12 à 25)MsgBox LBound(arrValue)MsgBox LBound(arrValue, 1)MsgBox LBound(arrValue, 2)MsgBox LBound(arrValue, 3)Fin du sous-marin |
Résultat : 1, 1, 4, 12