Archive of Mr Excel Message Board


Back to General Excel archive index
Back to archive home

Display formula in a cell

Posted by Rich Allwes on January 08, 2002 9:05 AM
Is there an existing macro or formula for displaying the formula contained in a cell in another cell.

For example: The number 25 is displaced in cell A3.

I want to list the formula "=3*gamma-beta of cell A3 in cell B3. Gamma and beta are range names of cells.

I would appreciate help in this matter.


Re: Display formula in a cell

Posted by Andy Gee on January 08, 2002 9:25 AM

Why not just type it then format it as text!


Re: Display formula in a cell

Posted by Dat on January 08, 2002 10:15 AM
Push---- Ctrl + ~ at the same time (~ is under the Esc key)


Re: Display formula in a cell

Posted by Chris D on January 08, 2002 10:31 AM
Would you want the displayed formula to change if you changed the original formula, without having to do any typing or anything ?

If you do, I have a very cumbersome non-macro fix which I'm sure can be put to shame by the VBA guys on this site...

If not, then the suggestions below would be what I'd do...

give me a shout
Chris


Re: Display formula in a cell

Posted by Stephen Giles on January 09, 2002 6:29 AM

This code will show the formula in an individual cell:
Function CellFormula(c)
CellFormula = c.Formula
End Function

Press alt+F11, insert a module and paste in the code. If say you want to see the formula in A1, enter =cellformula(A1) in another cell and that formula will appear.


This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.