Fonction UBound
Renvoie la limite supérieure d'une matrice.
Syntaxe :
UBound (NomMatrice [, Dimension])
Valeur de retour :
Nombre entier
Paramètres :
ArrayName : nom de la matrice dont la limite supérieure (Ubound) ou inférieure (LBound) doit être déterminée.
[Dimension] : nombre entier indiquant la dimension pour laquelle la limite supérieure (Ubound) ou inférieure (LBound) doit être renvoyée. Si aucune valeur n'est indiquée, c'est la limite de la première dimension qui est renvoyée.
Exemple :
Sub ExampleUboundLbound
Dim sVar(10 To 20) As String
Print LBound(sVar())
Print UBound(sVar())
End Sub
Sub ExampleUboundLbound2
Dim sVar(10 To 20,5 To 70) As String
Print LBound(sVar()) ' Renvoie 10
Print UBound(sVar()) ' Renvoie 20
Print LBound(sVar(),2) ' Renvoie 5
Print UBound(sVar(),2) ' Renvoie 70
End Sub