Ubound for variant not working for some reason, can anyone see why?

Discussion in 'Excel Programming' started by Mark Stephens, Apr 23, 2014.

  1. I have an array inside a variant which has 6,000 rows and two columns, when I try to read its Ubound value it returns 3! There's really nothing to the code so I know there's not too much to go on:

    Dim lNoRowsExistingData As Long

    lNoRowsExistingData = UBound(pvarrCht1, 1)


    I checked the array (pvarrCht1) just before the code executes it appears to be correct (with 600 rows, two columns),anyone any idea why this doesn't work it's very bafflng?

    Any help much appreciated, kind regards, Mark
     
    Mark Stephens, Apr 23, 2014
    #1
    1. Advertisements

  2. Re: Ubound for variant not working for some reason, can anyone seewhy? SOLVED

    On Wednesday, 23 April 2014 10:42:29 UTC+7, Mark Stephens wrote:
    > I have an array inside a variant which has 6,000 rows and two columns, when I try to read its Ubound value it returns 3! There's really nothing to the code so I know there's not too much to go on:
    >
    >
    >
    > Dim lNoRowsExistingData As Long
    >
    >
    >
    > lNoRowsExistingData = UBound(pvarrCht1, 1)
    >
    >
    >
    >
    >
    > I checked the array (pvarrCht1) just before the code executes it appears to be correct (with 600 rows, two columns),anyone any idea why this doesn't work it's very bafflng?
    >
    >
    >
    > Any help much appreciated, kind regards, Mark


    Sorry realised my error I didn't dimension the array properly!
     
    Mark Stephens, Apr 23, 2014
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael168

    Ubound & Lbound

    Michael168, Jun 1, 2004, in forum: Excel Programming
    Replies:
    3
    Views:
    154
    Tom Ogilvy
    Jun 1, 2004
  2. Stephen Rasey

    UBound not in Intellisense. References problem?

    Stephen Rasey, Sep 26, 2004, in forum: Excel Programming
    Replies:
    3
    Views:
    141
    Tom Ogilvy
    Sep 27, 2004
  3. Mike NG

    Handling ubound on an uninitialised array

    Mike NG, Jan 23, 2005, in forum: Excel Programming
    Replies:
    14
    Views:
    191
    Mike NG
    Jan 24, 2005
  4. Eric

    dif Ubound for member array when debugging

    Eric, May 28, 2005, in forum: Excel Programming
    Replies:
    1
    Views:
    89
    Nick Hebb
    May 28, 2005
  5. paulharvey

    UBound of multi-dimensional array?

    paulharvey, Aug 16, 2005, in forum: Excel Programming
    Replies:
    2
    Views:
    137
    Jake Marx
    Aug 16, 2005
  6. Replies:
    2
    Views:
    97
  7. BEETAL

    UBound function does not work

    BEETAL, Aug 30, 2008, in forum: Excel Programming
    Replies:
    5
    Views:
    166
    Dana DeLouis
    Sep 3, 2008
  8. TD
    Replies:
    1
    Views:
    154
    OssieMac
    Apr 22, 2009
Loading...