View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Flanagan[_2_] Bob Flanagan[_2_] is offline
external usenet poster
 
Posts: 81
Default Count items in a column

The following will store the count of the non blank cells for the first 20
columns of the active worksheet:

Dim myArray(1 To 20) As Integer
Dim I As Integer
For I = 1 To 20
myArray(I) = Application.CountA(Columns(I))
Next

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Chad" wrote in message
...
Hi All,

I am sure this is the easiest thing in the world, but I cannot find the
command.

I have about 20 columns, with random numbers of entries in each column. I
need a command to count the items in each column and store each count in a
seperate variable.

I have the loop setup and the variables, I just need the command to count
the items.

Thanks in advance,
Chad