View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Range within Formula

ctiveCell = Application.CountIf(rng, "0")


--
Don Guillett
SalesAid Software

"Helmut" wrote in message
...
Don,
that worked, thanks. trying to apply it to COUNTIF as follows and it
doesn't:

lastrow = Cells(Rows.Count, "g").End(xlUp).Row
Set rng = Range("G2:G" & lastrow)
ActiveCell = Application.COUNTIF(rng,""0"")"

HELP
Helmut
"Don Guillett" wrote:

Sub dosum()
lastrow = cells(rows.count,"g").end(xlup).row
Set rng = Range("G2:G" & lastrow)
'ActiveCell.FormulaR1C1 = "=SUM(rng)"
ActiveCell = Application.Sum(rng)
End Sub



--
Don Guillett
SalesAid Software

"Helmut" wrote in message
...
Hi,
I get a 'compile error' on SUM
helmut

"Don Guillett" wrote:

try just leaving the value

ActiveCell.value=SUM(rng)
--
Don Guillett
SalesAid Software

"Helmut" wrote in message
...
Hi...I have....

Set rng = Range("G2:G" & lastrow)

want to use rng in formula:

ActiveCell.FormulaR1C1 = "=SUM(rng)"

How???