![]() |
Macro with formulas...
Hello,
I am trying to create a macro that records "ultra- repetative" keystrokes in a spreadsheet. I have to select a cell, enter the "=" sign in it, then select the cell directly above it. If I start in cell A2, then, at this point, it will read.. "=(A1" in cell A2... I need an absolute reference on the A1 cell reference in the formula contained in cell A2, so I type it in as such "=($A$1" At this point, I know that I'm going to add cell A1 to another random cell in the spreadsheet... while the macro is still recording I finish typing what I need the macro to be... =($A$1+ That's it... that's all I want. Is there something that states I cannot record a macro on an incomplete formula, or is there some type of workaround? |
You will have to use an inputbox to obtain the rest of the formula, then add
the result to the formula, before dropping it in the relevant cell. You could use something like Sub Macro1() Dim varEnd varEnd = Application.InputBox("Insert criteria", "Remainder of Formula") ActiveCell.Value = "=$A$1" & varEnd End Sub If you then want to insert +A20, to get a formula reading =$A$1+A20, then you would enter +A20 in the inputbox, and click on OK. to run the macro, press<Alt<F8, and select the macro HTH "Somecallmejosh" wrote: Hello, I am trying to create a macro that records "ultra- repetative" keystrokes in a spreadsheet. I have to select a cell, enter the "=" sign in it, then select the cell directly above it. If I start in cell A2, then, at this point, it will read.. "=(A1" in cell A2... I need an absolute reference on the A1 cell reference in the formula contained in cell A2, so I type it in as such "=($A$1" At this point, I know that I'm going to add cell A1 to another random cell in the spreadsheet... while the macro is still recording I finish typing what I need the macro to be... =($A$1+ That's it... that's all I want. Is there something that states I cannot record a macro on an incomplete formula, or is there some type of workaround? |
Thank you very much, I will try this and send feedback
upon completion. -----Original Message----- You will have to use an inputbox to obtain the rest of the formula, then add the result to the formula, before dropping it in the relevant cell. You could use something like Sub Macro1() Dim varEnd varEnd = Application.InputBox("Insert criteria", "Remainder of Formula") ActiveCell.Value = "=$A$1" & varEnd End Sub If you then want to insert +A20, to get a formula reading =$A$1+A20, then you would enter +A20 in the inputbox, and click on OK. to run the macro, press<Alt<F8, and select the macro HTH "Somecallmejosh" wrote: Hello, I am trying to create a macro that records "ultra- repetative" keystrokes in a spreadsheet. I have to select a cell, enter the "=" sign in it, then select the cell directly above it. If I start in cell A2, then, at this point, it will read.. "=(A1" in cell A2... I need an absolute reference on the A1 cell reference in the formula contained in cell A2, so I type it in as such "=($A$1" At this point, I know that I'm going to add cell A1 to another random cell in the spreadsheet... while the macro is still recording I finish typing what I need the macro to be... =($A$1+ That's it... that's all I want. Is there something that states I cannot record a macro on an incomplete formula, or is there some type of workaround? . |
All times are GMT +1. The time now is 12:03 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com