formula to show a formula in a different cell

T

Todd

How do I get a formula to show info from the formula used in a different cell?

A1 =sheet name!*f33

B1 =formula to tell me the sheet name used in A1's formula


Thanks,


Todd
 
D

Dave F

Two options:
1) put an apostrophe to the left of the formula in A1, copy and paste the
entire text string int0 B1, or
2) Create a UDF with the following code:
Function GetFormula(Cell As Range) As String
GetFormula = Cell.Formula
If Cell.HasArray Then GetFormula = "{" & GetFormula & "}"
End Function

To create a UDF, right-click on the tab, select view code, and then in the
left hand pane navigate to your workbook. Inset a module, paste the above
code into the module, save, close out of the visual basic editor, go back to
B2 and enter =getformula(A1) and watch your formula appear.

Dave
 
Top