ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Relative Range in a Formula (https://www.excelbanter.com/excel-programming/307137-relative-range-formula.html)

ALEX

Relative Range in a Formula
 
I have a relative range that I need to capture in a SUM formula, recording
the macro gives me this. Is there a way to capture the true range?


This is what's in my SUB...
ActiveCell.FormulaR1C1 = "=SUM(R[-66]C:R[-1]C)"

Thanks!!





ALEX

Relative Range in a Formula
 
Never mind found it...

SUMMING A RANGE

With ActiveCell
Set ColRange = Range(.Offset(-1), .Offset(-1).End(xlUp))
.Formula = "=sum( " & ColRange.Address(RowAbsolute:=False) & ")"
End With





"Alex" wrote:

I have a relative range that I need to capture in a SUM formula, recording
the macro gives me this. Is there a way to capture the true range?


This is what's in my SUB...
ActiveCell.FormulaR1C1 = "=SUM(R[-66]C:R[-1]C)"

Thanks!!






All times are GMT +1. The time now is 03:59 AM.

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