Return the number of rows in an array

atf32

Board Regular
Joined
Apr 13, 2011
Messages
157
Looking for a function that returns the number of rows that exist and an array. I used "Ubound", but if there is only one row in the array, I end up with the number of columns in the array.:confused:
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I have no idea what you're asking.
Are you talking about 2 dimensional array?

Is so, what is the row and column of the array?
array(r)(c) ?
 
Upvote 0
How have you created/populated this array?

If it has more than one dimension you can use the 2nd argument of UBound to specify which dimension you want the upper bound for.

If it is rows and columns you can use something like this:
Code:
arrvals = Range("C1:G3").Value
cols = UBound(arrvals, 2)
rws = UBound(arrvals, 1)
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,904
Members
452,948
Latest member
Dupuhini

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