PC Review


Reply
Thread Tools Rate Thread

Count items in a column

 
 
Chad
Guest
Posts: n/a
 
      8th Feb 2008
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


 
Reply With Quote
 
 
 
 
Bob Flanagan
Guest
Posts: n/a
 
      8th Feb 2008
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
Chad
Guest
Posts: n/a
 
      8th Feb 2008
Thanks

"Chad" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SUMPRODUCT to count items with duplicates where another column contains two defined items PCLIVE Microsoft Excel Worksheet Functions 4 8th Sep 2007 10:33 AM
How do I sort - and count - items in a column? VanS Microsoft Excel Misc 1 21st Dec 2006 06:07 AM
How do I count the items in one column if another column is blank =?Utf-8?B?ZGVyZWtzbW9t?= Microsoft Excel Worksheet Functions 1 8th Nov 2006 11:34 PM
Count Column B items if Column A are from the same month Simon. Microsoft Excel Worksheet Functions 2 29th Jan 2004 04:40 AM
Count items in a column Peter Nunez Microsoft Excel Misc 1 10th Oct 2003 05:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:17 AM.