A function that returns the formula of a cell as a string
Hi
Create an user defined function (UDF) for this. Open VBA Editor (Alt+F11),
add a module, and copy the code from below the
-----------
Option Explicit
Public Function ShowFormula(varCell As Range, Optional parVolatile As Date)
As String
ShowFormula = varCell.Formula
End Function
------------
Now, into B3 enter the formula
=SHOWFORMULA(A3,NOW())
Of-course this UDF example is written on fly, without any error checkings
etc., so to make it really usable, you have to improve it. But it will be a
good starting point.
--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )
"Lacty" wrote in message
...
Hi
Does anyone know how to write a formula which will return the formula
in another cell as a string?
e.g if A3 contains the formula A1+ A2, I want to write a formula in B3
with will return the formula in A3 as string '= A1 + A2. Hence the
value in B3 will be string '= A1 + A2
Thanks in advance
Lacty
|