LBound Function

Retorna el límit inferior d'una matriu.

Sintaxi:

LBound (ArrayName [, Dimension])

Valor de retorn:

Enter

Paràmetres:

ArrayName: Nom de la matriu per a la qual voleu tornar el límit superior (Ubound) o inferior (LBound) de la dimensió de matriu.

[Dimension]: Enter que especifica quina dimensió tornar per al límit superior (Ubound) o inferior (LBound). Si no s'especifica cap valor, s'assumeix la primera dimensió.

Codis d'error

5 La crida al procediment no és vàlida

9 L'índex és fora de l'interval definit

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()) ' Torna 10

    Print UBound(sVar()) ' Torna 20

    Print LBound(sVar(),2) ' Torna 5

    Print UBound(sVar(),2) ' Torna 70

End Sub