Thread: Showing Formula
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
eliano eliano is offline
external usenet poster
 
Posts: 25
Default Showing Formula

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

"JV" wrote:

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.