#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default VBA SUM

Is there some way of adding some VBA to add a sum formula
in the last row of some data i have. I would need the sum
in Column C.

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default VBA SUM

Edgar,

Try something like the following:

Dim Rng As Range
Set Rng = Cells(Rows.Count, "C").End(xlUp)(2, 1)
Rng.Formula = "=SUM(C1:" & Rng(0, 1).Address(False, False) & ")"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Edgar" wrote in message
...
Is there some way of adding some VBA to add a sum formula
in the last row of some data i have. I would need the sum
in Column C.

Thanks




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



All times are GMT +1. The time now is 10:07 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"