Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

SUM total into separate worksheet

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Martin - 20 Mar 2006 17:56 GMT
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))"
Tom Ogilvy - 20 Mar 2006 18:37 GMT
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

Signature

Regards,
Tom Ogilvy

> I would like to use this code to SUM the total of column G into a different
> worksheet. How do I do this?
[quoted text clipped - 4 lines]
> Set r = Range("G" & Rows.Count).End(xlUp).Offset(2, 0)
> r.FormulaR1C1 = "=SUM(R2C:OFFSET(RC,-2,0))"
Martin - 20 Mar 2006 21:05 GMT
Tom I'm getting the value on Sheet1.

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

Signature

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?
[quoted text clipped - 4 lines]
> Set r = Range("G" & Rows.Count).End(xlUp).Offset(2, 0)
> r.FormulaR1C1 = "=SUM(R2C:OFFSET(RC,-2,0))"
Tom Ogilvy - 20 Mar 2006 22:27 GMT
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

Signature

Regards,
Tom Ogilvy

> Tom I'm getting the value on Sheet1.
>
[quoted text clipped - 18 lines]
> > Set r = Range("G" & Rows.Count).End(xlUp).Offset(2, 0)
> > r.FormulaR1C1 = "=SUM(R2C:OFFSET(RC,-2,0))"
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.