View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
lawson lawson is offline
external usenet poster
 
Posts: 44
Default A function to Turn Formula into Text?

fantastic, thank you very much. this tool should be a standard funtion of
Excel!

"Ron Rosenfeld" wrote:

On Thu, 20 Dec 2007 07:47:02 -0800, lawson
wrote:

can either of you show me an example of how to use these functions and what
it will produce? do i out this VBA in the workbook section and type
=showformula(d34) or =eval(d34) in a cell or what?



To enter the UDF, <alt-F11 opens the VB Editor. Ensure your project is
highlighted in the Project Explorer Window, then Insert/Module and paste the
code into the window that opens.

To use the formula, enter =showformula(d34) into some cell (e.g. E34)


Results (taken from a current worksheet of mine:

A1 contains and displays:
C:\Documents and Settings\Local Settings\My Local
Data\Graduation\campusmap.pdf


D34 contains:
=MID(A1,1+FIND(CHAR(1),SUBSTITUTE(A1,"\",CHAR(1),
LEN(A1)-LEN(SUBSTITUTE(A1,"\","")))),255)

D34 displays: campusmap.pdf

E34 contains: =showformula(D34)

E34 displays:

=MID(A1,1+FIND(CHAR(1),SUBSTITUTE(A1,""\"",CHAR(1) ,
LEN(A1)-LEN(SUBSTITUTE(A1,""\"","""")))),255)

--ron