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

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???