When I am creating a file for my training or for my blog or other articles that I write I regularly use the FORMULATEXT function to display the formula in a cell on the right of the actual formula. To save time I created a macro to do the work for me.
The macro is used is shown below.
Sub InsertFormulaText() ' Inserts the FORMULATEXT function in the selected range ' refers to the cell on the left of the selected range Selection.Formula = "=FORMULATEXT(RC[-1])" End Sub |
The RC[-1] is a relative reference to the column on the left. The -1 after the C means refer to the column on the left. A positive number would refer to a column on the right.
You select the range before running this macro.
This macro saves me a few keystrokes each time I use it as I run it off the Quick Access Toolbar.
See this post on running macros from the Quick Access Toolbar.
If you are new to macros check out this free webinar on Macros. It includes a pdf manual.
Dear Neale
Following code also works:
Selection = “=FORMULATEXT(RC[-1])”
Thanks Sandeep
Welcome Neale.
Happy Spreadsheet Day.