ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need interpretation (https://www.excelbanter.com/excel-programming/282286-need-interpretation.html)

JMay

Need interpretation
 
Sub test()
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=SUM(R[-7]C:R[-1]C)" <<See Note
End Sub

First please verbalize the "=SUM(R[-7]C:R[-1]C)" syntax, I can't get it..

<<Note : this line created separately using Macro recorder with Cell A8
active at the time. It appears to be an absolute address (with the 7 in
it).
How can I change the "=SUM(R[-7]C:R[-1]C)" portion
on code to always run from one cell up to the top row of my column?

Thanks in Advance,,




Tom Ogilvy

Need interpretation
 
it means to sum in the current column -7 cells up from this cell down to -1
cell from this cell (this cell being the cell with the formula). To sum
from the first cell in the column of the active cell to one cell above the
active cell, you would use
ActiveCell.FormulaR1C1 = "=SUM(R1C:R[-1]C)"

R1C is absolute R1 this column
R[-1]C is the cell above the cell with the formula (this is relative to
row)

--
Regards,
Tom Ogilvy


"JMay" wrote in message news:iBqsb.5942$5e.491@lakeread06...
Sub test()
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=SUM(R[-7]C:R[-1]C)" <<See Note
End Sub

First please verbalize the "=SUM(R[-7]C:R[-1]C)" syntax, I can't get

it..

<<Note : this line created separately using Macro recorder with Cell A8
active at the time. It appears to be an absolute address (with the 7 in
it).
How can I change the "=SUM(R[-7]C:R[-1]C)" portion
on code to always run from one cell up to the top row of my column?

Thanks in Advance,,






JMay

Need interpretation
 
Thanks Tom; I've printed your comments in order to study.
JMay

"Tom Ogilvy" wrote in message
...
it means to sum in the current column -7 cells up from this cell down

to -1
cell from this cell (this cell being the cell with the formula). To sum
from the first cell in the column of the active cell to one cell above the
active cell, you would use
ActiveCell.FormulaR1C1 = "=SUM(R1C:R[-1]C)"

R1C is absolute R1 this column
R[-1]C is the cell above the cell with the formula (this is relative to
row)

--
Regards,
Tom Ogilvy


"JMay" wrote in message

news:iBqsb.5942$5e.491@lakeread06...
Sub test()
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=SUM(R[-7]C:R[-1]C)" <<See Note
End Sub

First please verbalize the "=SUM(R[-7]C:R[-1]C)" syntax, I can't get

it..

<<Note : this line created separately using Macro recorder with Cell

A8
active at the time. It appears to be an absolute address (with the 7 in
it).
How can I change the "=SUM(R[-7]C:R[-1]C)" portion
on code to always run from one cell up to the top row of my column?

Thanks in Advance,,









All times are GMT +1. The time now is 12:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com