A way of retrieving the number of elements in a VBA Array

m6wiq

New Member
Joined
Aug 1, 2017
Messages
2
Hi Guys,

I have a small project of developing some VBA Code to simplify a spreadsheet for specifiing IO for Control Systems. In my VBA Code, I have utilised an Array in order to work with the specified spreadsheet range as CountIF will not do what I want it to do (Long Story).

Anyway, I would like to know how I would be able to get a count of the number of entries in my array. Not a count of the values stored in them.

Many thanks,

William
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I have utilised an Array in order to work with the specified spreadsheet range

Hi William
Welcome to the board

Notice that if you read a range into an array you may have 2 indices. In that case use the second parameter of LBound() and UBound() to get the limits.
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

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