Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting Math Expression From String to Real

Status
Not open for further replies.

GGleason

Technical User
Mar 22, 2001
321
US
I would like to do something that seems to be simple to do but I don’t know how to go about it. I have a string variable (such as “8 / 4” or “50.26 + 9.7”). I would like to evaluate this expression and convert it into a real number (such as 2 or 59.76).

Is there a function within VBA to do this?

TIA,
GGleason
 
? Eval("8 / 4")
2

? Eval("50.26 + 9.7")
59.96

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 

Michael,

Thank you for the tip. Too bad a function like this does not exist in Excel.

GGleason
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top