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!