formula to show a formula in a different cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top