![]() |
SUM total into separate worksheet
I would like to use this code to SUM the total of column G into a different
worksheet. How do I do this? Thanks. Set sh = Workbooks.Application.ActiveSheet Set r = Range("G" & Rows.Count).End(xlUp).Offset(2, 0) r.FormulaR1C1 = "=SUM(R2C:OFFSET(RC,-2,0))" |
SUM total into separate worksheet
assume you mean column G in sheet1
Dim rng as Range, cell as Range With worksheets("sheet1") set rng =.range("G2",.cells(rows.count,"G").End(xlup)) end with With worksheets("Sheet2") set cell = cells(rows.count,1).End(xlup)(2) cell.formula = "=sum(" & rng.Address(1,1,xlA1,True) & _ ")" End With -- Regards, Tom Ogilvy "Martin" wrote: I would like to use this code to SUM the total of column G into a different worksheet. How do I do this? Thanks. Set sh = Workbooks.Application.ActiveSheet Set r = Range("G" & Rows.Count).End(xlUp).Offset(2, 0) r.FormulaR1C1 = "=SUM(R2C:OFFSET(RC,-2,0))" |
SUM total into separate worksheet
Tom I'm getting the value on Sheet1.
"Tom Ogilvy" wrote in message ... assume you mean column G in sheet1 Dim rng as Range, cell as Range With worksheets("sheet1") set rng =.range("G2",.cells(rows.count,"G").End(xlup)) end with With worksheets("Sheet2") set cell = cells(rows.count,1).End(xlup)(2) cell.formula = "=sum(" & rng.Address(1,1,xlA1,True) & _ ")" End With -- Regards, Tom Ogilvy "Martin" wrote: I would like to use this code to SUM the total of column G into a different worksheet. How do I do this? Thanks. Set sh = Workbooks.Application.ActiveSheet Set r = Range("G" & Rows.Count).End(xlUp).Offset(2, 0) r.FormulaR1C1 = "=SUM(R2C:OFFSET(RC,-2,0))" |
SUM total into separate worksheet
I left off a period. See revised:
Dim rng as Range, cell as Range With worksheets("sheet1") set rng =.range("G2",.cells(rows.count,"G").End(xlup)) end with With worksheets("Sheet2") set cell = .cells(rows.count,1).End(xlup)(2) cell.formula = "=sum(" & rng.Address(1,1,xlA1,True) & _ ")" End With -- Regards, Tom Ogilvy "Martin" wrote: Tom I'm getting the value on Sheet1. "Tom Ogilvy" wrote in message ... assume you mean column G in sheet1 Dim rng as Range, cell as Range With worksheets("sheet1") set rng =.range("G2",.cells(rows.count,"G").End(xlup)) end with With worksheets("Sheet2") set cell = cells(rows.count,1).End(xlup)(2) cell.formula = "=sum(" & rng.Address(1,1,xlA1,True) & _ ")" End With -- Regards, Tom Ogilvy "Martin" wrote: I would like to use this code to SUM the total of column G into a different worksheet. How do I do this? Thanks. Set sh = Workbooks.Application.ActiveSheet Set r = Range("G" & Rows.Count).End(xlUp).Offset(2, 0) r.FormulaR1C1 = "=SUM(R2C:OFFSET(RC,-2,0))" |
All times are GMT +1. The time now is 04:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com