Contents

# UBound Function

傳回陣列的上邊界。

### Syntax:

    UBound(ArrayName [, Dimension])

### Return type:

Long

### Parameters:

ArrayName：要確定其上邊界 (Ubound) 或下邊界 (LBound) 的陣列之名稱。

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

### 錯誤代碼：

5 無效的程序呼叫

9 索引超出定義範圍

### Example:

    Sub VectorBounds
        Dim v(10 To 20) As String
        Print LBound(v()) ' 10
        Print UBound(v) ' 20
    End Sub

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

Please support us!