Converting formulas to value


Posted by Mary Beth on January 08, 2001 8:18 AM

I am trying to hardcode my formula so that the cell refrences are removed but the numbers in the calculation are shown. An example is below:
A1=1000
B2= 3000
Formula is =A1+B2 (screen shows 4000)
What I want to do is to write VBA code that will hardcode my formula so that the formula bar will now show =1000+3000 and the screen shows 4000.
Thoughts??

Posted by Aaron on January 08, 2001 9:01 AM

Try this:

Cells.Replace What:="A1", Replacement:=Range("A1").Value, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True


Posted by Mary Beth on February 01, 2001 8:37 AM




Posted by Mary Beth on February 01, 2001 8:42 AM

I need to convert a formula to a value where the operator is not a plus sign. For instance, I have the formula
if(a1>b1, a1, b1)
a1=100
b1=80
I want to see: if(100>80,100,80)

Alternatively, what if I need to subtract something?
if(a1>b1, a1-b1, b1)
I want to see: if(100>80, 100-80, 80)

THANK YOU!!