View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ken Hudson Ken Hudson is offline
external usenet poster
 
Posts: 186
Default Convert Input String Formula to Number

I have an input box that prompts the user for a math formula, e.g. 5+3-2.5/6
How can I get VB to do the math on that string and return the answer?

Option Explicit

Dim InpStr As String
Dim Ans as Double

Sub DoMath()

InpStr = InputBox("Enter formula.")

Ans = convert InpStr to formula and solve

MsgBox "Answer is: " & Ans

End Sub
--
Ken Hudson