Solved

Counting No. of values in Arrays

Posted on 1998-08-27
1
123 Views
Last Modified: 2010-04-30
I define an array of 10 items, say a[10].
I give for 3 arrays say a[0] = 38, a[3] = 980, a[7] = 98
The remaining arrays 7 of them are without values.
What I want is to get the count of number of arrays (with values) and in this case should give the count as 3.

Is there any function /user defined logic to do this one.
Anticipating a postive response from your end for this case.
Thankyou in advance for your help.
0
Comment
Question by:Favourites
1 Comment
 
LVL 6

Accepted Solution

by:
clifABB earned 10 total points
ID: 1431354
Nope, sorry.

The best you can do is:
nCount = 0
For nCnt1 = LBound(a) to UBound(a)
  If a(nCnt1) > 0 Then
    nCount = nCount + 1
  End If
Next nCnt1
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question