Showing Formula

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

Guest

Hello

I have a cell calculate based on info from other cells. How do I make the
cell show the formula when selected instead of the hardcoded result?

Thanks in advance.
 
Hi JV.
Try:

Public Function MyValue(aCell As Range) As Variant
by Norman Jones in m.p.i.o.e
Dim myVal As Variant
myVal = Replace(aCell.Formula, Application. _
International(xlDecimalSeparator), ".")
myVal = Evaluate(myVal)
If IsError(myVal) Then
MyValue = CVErr(xlErrNA)
Else
MyValue = myVal
End If
End Function

in A1: D1+E1*F1-10
in B1: =MyValue(A1)

Regards
Eliano
 

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