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

M

Mark Stephens

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
 
M

Mark Stephens

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!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top