View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default A function that returns the formula of a cell as a string

Hi,

With a function. Alt + F11 to open VB editor. Right click 'This Workbook'
and insert module and paste this in

Function ShowFormula(Cell As Range) As String
ShowFormula = Cell.Formula
End Function

In a worksheet cell type
=showformula(A1)

Mike

"Lacty" wrote:

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