Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
cut & paste made the cell with forumla #ref | Excel Discussion (Misc queries) | |||
Copy & Paste Forumla - but reference cell is changing | Excel Discussion (Misc queries) | |||
pasting a forumla w/o the paste/special/value | Excel Discussion (Misc queries) | |||
Copy and Paste macro needs to paste to a changing cell reference | Excel Programming | |||
Macro to Copy/Paste then Paste to Next Line | Excel Programming |