Função LBound

Devolve o limite inferior de uma matriz.

Sintaxe:

LBound (NomeMatriz [, Dimensão])

Valor de retorno:

Número inteiro

Parâmetros:

NomeMatriz: nome da matriz à qual pretende devolver o limite superior (Ubound) ou inferior (LBound) da dimensão da matriz.

[Dimension]: Integer that specifies which dimension to return the upper (Ubound) or the lower (LBound) boundary for. If a value is not specified, the first dimension is assumed.

Códigos de erro

5 Chamada de procedimento inválido

9 Índice fora do intervalo definido

Exemplo:

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

    Print UBound(sVar()) ' devolve 20

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

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

End Sub