LBound Function

傳回陣列的下邊界。

Syntax:


LBound(ArrayName[, Dimension])

Return value:

Long

Parameters:

ArrayName:要傳回某陣列維上邊界 (Ubound) 或下邊界 (LBound) 的陣列之名稱。

[Dimension]:用於指定維的整數。函式將傳回此維的上邊界 (Ubound) 或下邊界 (LBound)。如果不指定此值,則傳回第一維的邊界。

錯誤代碼:

5 無效的程序呼叫

9 索引超出定義範圍

Example:


Sub VectorBounds
    Dim v(10 To 20) As String
    Print LBound(v()) ' returns 10
    Print UBound(v) ' returns 20
End Sub ' VectorBounds
 
Sub TableBounds
    Dim t(10 To 20,-5 To 70) As Currency
    Print LBound(t), UBound(t()) ' returns 10  20
    Print LBound(t(),2) ' returns - 5
    Print UBound(t,2) ' returns 70
End Sub ' TableBounds

Please support us!