If you simply want the count of the number of elements in an array,
irrespection of the humber of dimensions it has, try:
Sub xy()
cnt = 0
For Each ele In YourArray
cnt = cnt + 1
Next
End Sub
"Rob van Gelder" wrote:
I have an example of how to determine number of dimensions in array on my
website "Number of Dimensions"
My routine trials until it errors - just as you say.
--
Rob van Gelder - http://www.vangelder.co.nz/excel
"AA2e72E" wrote in message
...
There is no built-in support for finding the dimensions of an array in
VBA/VB
without prior knowledge of its rank (number of dimensions). The nearest
solution is to do it by trial and error.
"Alan Beban" wrote:
NickHK wrote:
ajitpalsingh200,
Dim ArrayItemCount as Long
ArrayItemCount =UBound(DiscreteData)-LBound(DiscreteData)
NickHK
The above works for a 1-based array; to allow for a 0-based or 1-based
array, substitute
ArrayItemCount =UBound(DiscreteData)-LBound(DiscreteData) + 1
Alan Beban
"ajitpalsingh200" wrote
in
message ...
How do i count the number of items in array
lets say i have declaration as below
DiscreteData = Array("MPN", "Vendor")
How do i count the items?
thankx in adavance
--
ajitpalsingh200
------------------------------------------------------------------------
ajitpalsingh200's Profile:
http://www.excelforum.com/member.php...o&userid=16150
View this thread:
http://www.excelforum.com/showthread...hreadid=320512