ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro procedures (https://www.excelbanter.com/excel-programming/320842-macro-procedures.html)

Danita

Macro procedures
 
I am trying to record a macro which begins with a cell that I click on, and
the references up the same column 5 rows to complete a calculation. Once
finished it should move down 5 rows and repeat process. Can't make it not
reference specific cell. Any suggestions??

Tom Ogilvy

Macro procedures
 
Sub AAA()
ActiveCell.FormulaR1C1 = "=Sum(R[-1]C:R[-4]C)"
ActiveCell.Offset(5, 0).Select
End Sub

assume you click in E5. and run the macro

It will put in the formula =Sum(E1:E4), then move to E10. Click again, it
will put in the sum
=Sum(E6:E9) then move to E15

--
Regards,
Tom Ogilvy

"Danita" wrote in message
...
I am trying to record a macro which begins with a cell that I click on,

and
the references up the same column 5 rows to complete a calculation. Once
finished it should move down 5 rows and repeat process. Can't make it not
reference specific cell. Any suggestions??





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

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