Counting the number of elements within an array that have data

E

ExcelMonkey

I have a 1D VBA array filled with integers. I have gone through th
array and deleted various element (i.e. array(3) = "",array(7) = "
etc).

I now want to count the number of elements within the revised arra
which contain integers only (or no data at all - whatever is easier).

How do I do this?

Thank
 
G

Guest

If you use the code i gave you to transfer the Elements to a New array all you have to do is use UBound(Myarray) to get the upper number and then based on your Option base: 0 = Num -1 OR 1 = Nu

But if you just want to count then here

Dim i as single, j as singl
For i = LBound(YourArray) To UBound(YourArray
if Not MyArray(i) = "" then j =j+
Next
Debug.print "Total number of elements with a value = " &
Debug.Print "Total number of elements with No Value = " UBound(YourArray) -

----- ExcelMonkey > wrote: ----

I have a 1D VBA array filled with integers. I have gone through th
array and deleted various element (i.e. array(3) = "",array(7) = "
etc)

I now want to count the number of elements within the revised arra
which contain integers only (or no data at all - whatever is easier)

How do I do this

Thank
 

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