Evaluate string
Evaluate string
(OP)
Does anyone know how to have Excel evaluate the commands in a string? For example:
Cell A6 contains a numerical value.
Cell B6 contains the string "=A6*2"
I would like to have a cell that can convert the command in B6. In Matlab the command would be eval(string). Obviosly I am looking for a general solution to solve for any string.
Searching the Excel help files and some Googling only leads me to beleive that I need some VBA code. Can anyone help?
Thanks in advance.
Cell A6 contains a numerical value.
Cell B6 contains the string "=A6*2"
I would like to have a cell that can convert the command in B6. In Matlab the command would be eval(string). Obviosly I am looking for a general solution to solve for any string.
Searching the Excel help files and some Googling only leads me to beleive that I need some VBA code. Can anyone help?
Thanks in advance.
Best regards,
Matthew Ian Loew
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips Fora.





RE: Evaluate string
try:
SUB Q()
[C6].Formula=[B6].Text
END SUB
HTH
_LF
RE: Evaluate string
CODE
Eval = Evaluate(S)
End Function
Cheers,
Joerd
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.