Hi guys, I have a problem with some excel code that I am having trouble getting my head around.
Okay so I am using the application.evaluate command in excel vba, office 2007.
If i have Evaluate("SIN(45)")
it returns a nice predicted number. However if I do Evaluate("eq")
the code crashes.
eq is an equation i am reading in from excel. the equation is: 3*x^2+5*x+1
. It is passed in as a string. to make sure this happened I placed it in another variable that I had defined as a string. I replace the x's in the equation using excel's replace function. equation = Replace(equation, "x", temp)
.
However, when i get to the evaluate the code breaks down and I am not sure why. Total = Total + Evaluate("equation")
. Any help is greatly appreciated