Ubound with Muliple Columns

Rocky0201

Active Member
Joined
Aug 20, 2009
Messages
278
Hi..

I have defined vAry as a Variant. I ReDim this to have 2 columns:

ReDim vAry(330,38)

How do I use Ubound on the second column only (the 38 element column)?

I am trying to use a For loop but only on the second column.

For I = 1 to vAry(???)

This this possible?

If I code Ubound(vAry(0,0)) i receive Type mismatch.

Thanks...
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hello Rocky0201,

The UBound takes 2 arguments: The array name and the dimension number. In your array vAry(330,38), the upper boundaries are dimension 1 is 330, and dimension 2 is 38. Your code then would be...
For I = 1 to UBound(vAry, 2)​
 
Upvote 0
Hello Rocky0201,

You're welcome. If you have your VBA Help files installed you can find this information there also.
 
Upvote 0

Forum statistics

Threads
1,215,785
Messages
6,126,890
Members
449,347
Latest member
Macro_learner

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top