ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to adjust formulas (https://www.excelbanter.com/excel-programming/298069-re-macro-adjust-formulas.html)

Tom Ogilvy

Macro to adjust formulas
 
set rng = Cells(rows.count,"C").End(xlup)
activeCell.formula = "=Average(" & rng.offset(-11,0) _
.Resize(12,1).Address(0,0) & ")"

--
Regards,
Tom Ogilvy

"Hargrove" wrote in message
...
I need to record a macro that will adjust my formulas from one month to

the next. This month, I would average C22:C33, next month C23:C34. The
references will have to be relative as I will make the changes to several
cells.

Another way to look at it if it's easier is that I want to average the

last 12 months, but will be adding a new row each month. When I add the
row, the formula adjusts to start from the same place and include the new
row. I want it to include the new row, but start one row down




All times are GMT +1. The time now is 07:24 PM.

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