![]() |
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 |
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 |
All times are GMT +1. The time now is 05:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com