ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   COUNTA (https://www.excelbanter.com/excel-programming/394481-counta.html)

geebee

COUNTA
 
hi,

I have the following:

Dim CountActual As Integer
Range("c7:c" & lastactioncode).select
MsgBox lastactioncode
'Range("Z1").Formula = "=COUNTA(C7:C4715)"
Range("Z1").Formula = "=COUNTA(C7:C) & lastactioncode"
CountActual = Range("Z1").Value
MsgBox CountActual

When I use the part that is commented out, I DO NOT get an error. However,
when I use the Range("Z1").Formula = "=COUNTA(C7:C) & lastactioncode"
part, I do not get an error, but "0" appears as the value for CountActual.
Then I look in the Z1 cell, and I se the formula is as follows:
=COUNTA($G:Z) & lastactioncode

How can I solve this?

Thanks in advance,
geebee


Jim Thomlinson

COUNTA
 
Try this...

Range("Z1").Formula = "=COUNTA(C7:C" & lastactioncode & ")"

--
HTH...

Jim Thomlinson


"geebee" wrote:

hi,

I have the following:

Dim CountActual As Integer
Range("c7:c" & lastactioncode).select
MsgBox lastactioncode
'Range("Z1").Formula = "=COUNTA(C7:C4715)"
Range("Z1").Formula = "=COUNTA(C7:C) & lastactioncode"
CountActual = Range("Z1").Value
MsgBox CountActual

When I use the part that is commented out, I DO NOT get an error. However,
when I use the Range("Z1").Formula = "=COUNTA(C7:C) & lastactioncode"
part, I do not get an error, but "0" appears as the value for CountActual.
Then I look in the Z1 cell, and I se the formula is as follows:
=COUNTA($G:Z) & lastactioncode

How can I solve this?

Thanks in advance,
geebee


geebee

COUNTA
 
Thanks. This worked beautifully. I forgot about this... it's been a while.



"Jim Thomlinson" wrote:

Try this...

Range("Z1").Formula = "=COUNTA(C7:C" & lastactioncode & ")"

--
HTH...

Jim Thomlinson


"geebee" wrote:

hi,

I have the following:

Dim CountActual As Integer
Range("c7:c" & lastactioncode).select
MsgBox lastactioncode
'Range("Z1").Formula = "=COUNTA(C7:C4715)"
Range("Z1").Formula = "=COUNTA(C7:C) & lastactioncode"
CountActual = Range("Z1").Value
MsgBox CountActual

When I use the part that is commented out, I DO NOT get an error. However,
when I use the Range("Z1").Formula = "=COUNTA(C7:C) & lastactioncode"
part, I do not get an error, but "0" appears as the value for CountActual.
Then I look in the Z1 cell, and I se the formula is as follows:
=COUNTA($G:Z) & lastactioncode

How can I solve this?

Thanks in advance,
geebee



All times are GMT +1. The time now is 04:53 AM.

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