![]() |
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&")" |
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 |
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 |
All times are GMT +1. The time now is 05:57 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com