UBound Function

αžαŸ’αžšαž‘αž”αŸ‹β€‹αž–αŸ’αžšαŸ†αžŠαŸ‚αž“β€‹αžαžΆαž„β€‹αž›αžΎβ€‹αž“αŸƒβ€‹αž’αžΆαžšαŸβ€‹αž˜αž½αž™Β αŸ”

Syntax:


UBound (ArrayName [, Dimension])

Return value:

Long

Parameters:

ArrayName αŸ– αžˆαŸ’αž˜αŸ„αŸ‡β€‹αž“αŸƒβ€‹αž’αžΆαžšαŸ αžŠαŸ‚αž›β€‹αž’αŸ’αž“αž€β€‹αž…αž„αŸ‹β€‹αž€αŸ†αžŽαžαŸ‹β€‹αž–αŸ’αžšαŸ†αžŠαŸ‚αž“β€‹αžαžΆαž„β€‹αž›αžΎ (Ubound) αž¬β€‹αžαžΆαž„β€‹αž€αŸ’αžšαŸ„αž˜ (LBound)Β αŸ”

[Dimension] αŸ– αž…αŸ†αž“αž½αž“β€‹αž‚αžαŸ‹β€‹αžŠαŸ‚αž›β€‹αž”αž‰αŸ’αž‡αžΆαž€αŸ‹β€‹αžαžΎβ€‹αžœαž·αž˜αžΆαžαŸ’αžšβ€‹αžŽαžΆβ€‹αž˜αž½αž™β€‹αžŠαžΎαž˜αŸ’αž”αžΈβ€‹αžαŸ’αžšαž‘αž”αŸ‹β€‹αž–αŸ’αžšαŸ†αžŠαŸ‚αž“β€‹αžαžΆαž„β€‹αž›αžΎ (Ubound) αž¬β€‹αžαžΆαž„β€‹αž€αŸ’αžšαŸ„αž˜ (LBound)Β αŸ” αž”αŸ’αžšαžŸαž·αž“β€‹αž”αžΎβ€‹αž‚αŸ’αž˜αžΆαž“β€‹αžαž˜αŸ’αž›αŸƒβ€‹αžαŸ’αžšαžΌαžœβ€‹αž”αžΆαž“β€‹αž”αž‰αŸ’αž‡αžΆαž€αŸ‹ αž–αŸ’αžšαŸ†αžŠαŸ‚αž“β€‹αž“αŸƒβ€‹αžœαž·αž˜αžΆαžαŸ’αžšβ€‹αž‘αžΈβ€‹αž˜αž½αž™β€‹αžαŸ’αžšαžΌαžœβ€‹αž”αžΆαž“β€‹αžαŸ’αžšαž‘αž”αŸ‹Β αŸ”

Error codes:

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!