Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default summing through end of row

I'm trying to sum using vb from cell e3 to the bottom of the row which
will be a variable number of rows. For some reason, it doesn't like
the last line in my code. I think I may have done something wrong at
the end of the last line.

Dim Rng As Range
Set Rng = Range ("e3").End(xlDown)
rng.Offset (1,0).Formula="=SUM(E"&rng.row&")"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 420
Default summing through end of row

Dim Rng as range
set rng = activesheet.range("E3").end(xldown)
rng.offset(1,0).formular1c1 = "=sum(r1C:r[-1]c)"

Sometimes using the .formulaR1C1 reference style makes coding a lot easier. And
the user will still see the formula using the settings that they like.

R1C is Row 1 of the same column
R[-1]C is the row above the cell getting the formula, but the same column





On 07/27/2010 14:43, tbmarlie wrote:
I'm trying to sum using vb from cell e3 to the bottom of the row which
will be a variable number of rows. For some reason, it doesn't like
the last line in my code. I think I may have done something wrong at
the end of the last line.

Dim Rng As Range
Set Rng = Range ("e3").End(xlDown)
rng.Offset (1,0).Formula="=SUM(E"&rng.row&")"


--
Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 420
Default summing through end of row

And if you wanted from Row 3, then the .formular1c1 would be:

rng.offset(1,0).formular1c1 = "=sum(r3c:r[-1]c)"

(I didn't notice that portion of your question...)

On 07/27/2010 14:43, tbmarlie wrote:
I'm trying to sum using vb from cell e3 to the bottom of the row which
will be a variable number of rows. For some reason, it doesn't like
the last line in my code. I think I may have done something wrong at
the end of the last line.

Dim Rng As Range
Set Rng = Range ("e3").End(xlDown)
rng.Offset (1,0).Formula="=SUM(E"&rng.row&")"


--
Dave Peterson
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
Summing it up Violet 1 Excel Worksheet Functions 5 October 28th 08 08:57 PM
PivotTable and summing/not summing ~*Amanda*~[_2_] Excel Discussion (Misc queries) 1 March 14th 07 07:35 PM
Summing all BUT one... popunonkok Excel Worksheet Functions 6 April 26th 06 08:35 PM
Please Help with Summing mrharlow Excel Discussion (Misc queries) 1 February 11th 06 12:54 PM
Summing teresa Excel Programming 4 January 1st 05 03:29 AM


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