Forum Discussion
Don_Raflik
Aug 13, 2020Copper Contributor
Retrieve Formula from cell not value
I need to retrieve the existing formula from a cell not the value of the formula.
what function(s) do I use to do that?
4 Replies
- wumoladIron Contributor
- mathetesGold Contributor=FORMULATEXT(cellreference)
- Don_RaflikCopper Contributor
thank you for your reply.
I am working in VBA. I did find an answer that worked.
= .cells(cellrefernce).formula- PeterBartholomew1Silver Contributor
That would do it. If your version of Excel does not feature FORMULATEXT() you could emulate it with a UDF
Function showFormula(target As Range) As String showFormula = target.Formula End Functioncalled with
= showFormula(cellRef)
The Formula property and its variants can also be set from VBA, allowing the worksheet to be built from code.