Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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))"


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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))"



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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))"





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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))"






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
how to merge separate worksheet Jane Excel Worksheet Functions 1 May 15th 07 04:31 AM
Using a Worksheet Form to add data to a separate worksheet databas Rawblyn Excel Worksheet Functions 3 March 7th 06 08:17 PM
How do I separate a worksheet into many files? Alicia Excel Discussion (Misc queries) 1 February 15th 06 07:08 PM
1 column with YES and NO responses. Can we sum for ea. total of YES's and NO's? (Okay to put results into 2 separate cells). StargateFanFromWork[_3_] Excel Programming 6 December 8th 05 09:20 PM
Separate Worksheet Linking JaeP Excel Discussion (Misc queries) 0 May 17th 05 04:52 PM


All times are GMT +1. The time now is 06:52 AM.

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"