PC Review


Reply
Thread Tools Rate Thread

COUNTA error in Excel VBA

 
 
Wei
Guest
Posts: n/a
 
      30th Aug 2007
I have a column which store variables, I need to know how many variables in
the column with VBA, however, I cannot get it.
column A
John
..
Jason
..
Eric
...

I tried the following commands:
''''''''''''''''''''''''''''''''''''''''''''''''''
Dim a As Integer
a="=COUNTA(A:A)"
For ii=1 to a
..
..
..
Next ii
..
..
..
'''''''''''''''''''''''''''''''''''''''''''''''''
The return of a is always 1, can anyone help me?I just begin to learn VBA.
Thanks!
Wei

 
Reply With Quote
 
 
 
 
JW
Guest
Posts: n/a
 
      30th Aug 2007
Try a=worksheetfunction.CountA("A:A")

Wei wrote:
> I have a column which store variables, I need to know how many variables in
> the column with VBA, however, I cannot get it.
> column A
> John
> .
> Jason
> .
> Eric
> ..
>
> I tried the following commands:
> ''''''''''''''''''''''''''''''''''''''''''''''''''
> Dim a As Integer
> a="=COUNTA(A:A)"
> For ii=1 to a
> .
> .
> .
> Next ii
> .
> .
> .
> '''''''''''''''''''''''''''''''''''''''''''''''''
> The return of a is always 1, can anyone help me?I just begin to learn VBA.
> Thanks!
> Wei


 
Reply With Quote
 
Wei
Guest
Posts: n/a
 
      30th Aug 2007
I just figured it out
a=Application.CountA(Range("A:A"))
Thanks!
Wei
"JW" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Try a=worksheetfunction.CountA("A:A")
>
> Wei wrote:
>> I have a column which store variables, I need to know how many variables
>> in
>> the column with VBA, however, I cannot get it.
>> column A
>> John
>> .
>> Jason
>> .
>> Eric
>> ..
>>
>> I tried the following commands:
>> ''''''''''''''''''''''''''''''''''''''''''''''''''
>> Dim a As Integer
>> a="=COUNTA(A:A)"
>> For ii=1 to a
>> .
>> .
>> .
>> Next ii
>> .
>> .
>> .
>> '''''''''''''''''''''''''''''''''''''''''''''''''
>> The return of a is always 1, can anyone help me?I just begin to learn
>> VBA.
>> Thanks!
>> Wei

>


 
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
Set a counta function result in a for loop (Macro Excel) whitebalance Microsoft Excel Programming 1 13th Nov 2008 09:32 AM
Referencing CountA - Excel automation object not closing =?Utf-8?B?YXJjaGVyb2tpZQ==?= Microsoft Excel Programming 5 10th Oct 2007 08:29 PM
dynamic range counta error sammy.peters@gmail.com Microsoft Excel Programming 8 20th Aug 2007 02:08 PM
Similar to CountA in MS Excel chuaby@hotmail.com Microsoft Access Queries 3 29th May 2007 08:23 PM
WorksheetFunction.CountA - Excel 2000, Please help microsoft Microsoft Excel Programming 1 22nd Apr 2005 03:50 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:38 PM.