In this tutorial you will learn how to use the UBOUND Function.
The UBOUND Function returns a Long containing the largest available subscript for the indicated dimension of an array.
=UBOUND( arrayname [, dimension ] )
arrayname Name of the array variable
dimension [Optional] Whole number indicating which dimension's upper bound is returned. Use 1 for the first dimension, 2 for the second, and so on. If dimension is omitted, 1 is assumed.
In this example we will work with an array of numbers: Numbers(1,2,3,4)
The result is 4.
FORM
In a Form you could set the Default Value of a Textbox to
=UBOUND(Numbers)
VBA
In a Form add a TEXTBOX control and rename it "txtUBound", then you could add the following in the Load Event.
Private Sub Form_Load()
txtUBound = UBOUND(Numbers)
End Sub
Course
Want to learn more? Request this via the contact form.
Search
You can find more about this by searching the website.