Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default paste a forumla and copy with a macro

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cut & paste made the cell with forumla #ref Ms_M_o_n_i_c_a Excel Discussion (Misc queries) 6 August 4th 08 03:28 PM
Copy & Paste Forumla - but reference cell is changing Andy Excel Discussion (Misc queries) 5 October 12th 07 04:41 PM
pasting a forumla w/o the paste/special/value jc3000 Excel Discussion (Misc queries) 1 June 21st 07 02:13 PM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM
Macro to Copy/Paste then Paste to Next Line tomkarakowski Excel Programming 1 May 28th 04 01:19 AM


All times are GMT +1. The time now is 07:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"