ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   COUNTA error in Excel VBA (https://www.excelbanter.com/excel-programming/396637-counta-error-excel-vba.html)

Wei[_3_]

COUNTA error in Excel VBA
 
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


JW[_2_]

COUNTA error in Excel VBA
 
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



Wei[_3_]

COUNTA error in Excel VBA
 
I just figured it out
a=Application.CountA(Range("A:A"))
Thanks!
Wei
"JW" wrote in message
oups.com...
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





All times are GMT +1. The time now is 05:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com