HI,

The largest available subscript for the indicated dimension of an array can
be obtained by using theUbound function.  In our one-dimensional array
example, Ubound(arr) is 5.

In our two-dimensional array example above, there are two upper bound
figures - both are 2.
UBound returns the following values for an array with these dimensions*:

         Dim A(1 To 100, 0 To 3, -3 To 4)

         Statement             Return Value
         UBound(A, 1)                         100
         UBound(A, 2)                            3
         UBound(A, 3)                            4

* Example taken from Excel VBA Help section.

The UBound function is used with the LBound function to determine the size
of an array. Use theLBound function to find the lower limit of an array
dimension.

         Statement             Return Value
         LBound(A, 1)                            1
         LBound(A, 2)                            0
         LBound(A, 3)                           -3

To get the size of an array, use the following formula:

        UBound(Arr) - LBound(Arr) + 1

For example:

        Ubound(A,1) - LBound(A,1) + 1
        = 100 - 1 + 1
        = 100

        Ubound(A,2) - LBound(A,2) + 1
        = 3 - 0 + 1
        = 4

        Ubound(A,3) - LBound(A,3) + 1
        = 4 - (-3) + 1
        = 8

For more details please visit
http://www.anthony-vba.kefra.com/vba/vbabasic3.htm

<http://www.anthony-vba.kefra.com/vba/vbabasic3.htm>Cheers
Andy

On Sun, Sep 5, 2010 at 12:53 PM, bhavya khanna <bhavya...@gmail.com> wrote:

> Hi Everyone.
>
> Can Someone explain About Ubound and Lbound in Excel VBA  with Example. Or
> sending some attached sheet.
>
> Thanks and Regards
>
>  --
>
> ----------------------------------------------------------------------------------
> Some important links for excel users:
> 1. Follow us on TWITTER for tips tricks and links :
> http://twitter.com/exceldailytip
> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
> 3. Excel tutorials at http://www.excel-macros.blogspot.com
> 4. Learn VBA Macros at http://www.quickvba.blogspot.com
> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>
> To post to this group, send email to excel-macros@googlegroups.com
>
> <><><><><><><><><><><><><><><><><><><><><><>
> HELP US GROW !!
>
> We reach over 7000 subscribers worldwide and receive many nice notes about
> the learning and support from the group.Let friends and co-workers know they
> can subscribe to group at
> http://groups.google.com/group/excel-macros/subscribe
>

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 7000 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to