View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default paste a forumla and copy with a macro

Sub addFormulas()
Dim rng as Range
With worksheets("Sheet1")
set rng = .Range(.Cells(1,3),.Cells(rows.count,3).End(xlup))
End With
rng.offset(0,1).Formula = "=Sum(A1:C1)"
End Sub

--
Regards,
Tom Ogilvy



"Chris_t_2k5" wrote in message
...
Here is my problem. I have data in columns A:C however the number of rows
will differ each time.

I need a macro that will paste a preset formula eg. (=sum(A1:C1)) into

cell
D1 and drag it down to the last cell which contains data in the previous
columns?

Thanks in advance