Creating and evaluation user created forumlae.
Hi Tatumsa,
'=============
Public Sub Tester00Z1()
Dim Field1 As String
Dim Field2 As String
Dim Field3 As String
Dim Field4 As String
Field1 = "10"
Field2 = "10"
Field3 = "10"
Field4 = "10"
MsgBox CLng(Field1) * CLng(Field2) - (CLng(Field3) + CLng(Field4))
End Sub
'<<=============
In your scenario, the Field values are likely to represent TextBox values.
---
Regards,
Norman
"Tatumsa" wrote in message
oups.com...
I have a userform with a list of variables and operators which a user
can press to create a custom formula. The variable text entered by
clicking the button is the same name as that used in the code behind
the scenes. So a user would be able to create a text string looking
like "Field1 * Field2 - (Field3 + Field4)" etc.. Is there a way to
actually calculate a value from the string the userform returns? So for
the above example if all values were 10 you would get the number 80.
All the users are using Excel 2000.
|