Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a userform that is used to enter different data, and sometimes I have
to enter a formula in the textbox. Is there a way, using my existing txtField_Exit events to calculate the value if I enter something like "=2+2" and it gives me the answer when I tab away from the active textbox? -- I am running on Office 2003, unless otherwise stated. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
How about this Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) MySum = Evaluate(TextBox1.Text) End Sub Mike "Orion Cochrane" wrote: I have a userform that is used to enter different data, and sometimes I have to enter a formula in the textbox. Is there a way, using my existing txtField_Exit events to calculate the value if I enter something like "=2+2" and it gives me the answer when I tab away from the active textbox? -- I am running on Office 2003, unless otherwise stated. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks. I tried a variation that worked:
txtField.Value = Evaluate(txtField.text) This helped me immensly! -- I am running on Office 2003, unless otherwise stated. "Mike H" wrote: Hi, How about this Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) MySum = Evaluate(TextBox1.Text) End Sub Mike "Orion Cochrane" wrote: I have a userform that is used to enter different data, and sometimes I have to enter a formula in the textbox. Is there a way, using my existing txtField_Exit events to calculate the value if I enter something like "=2+2" and it gives me the answer when I tab away from the active textbox? -- I am running on Office 2003, unless otherwise stated. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Glad I could help and thanks for the feedback. I shpuld have pointed out you
could populate the textbox with the answer. You could also populate another textbox with the answer. If you do this then you should consider error trapping because if you enter something that can't be evaluated you will get an error. Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) On Error Resume Next TextBox1.Text = Evaluate(TextBox1.Text) End Sub Mike Mike "Orion Cochrane" wrote: Thanks. I tried a variation that worked: txtField.Value = Evaluate(txtField.text) This helped me immensly! -- I am running on Office 2003, unless otherwise stated. "Mike H" wrote: Hi, How about this Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) MySum = Evaluate(TextBox1.Text) End Sub Mike "Orion Cochrane" wrote: I have a userform that is used to enter different data, and sometimes I have to enter a formula in the textbox. Is there a way, using my existing txtField_Exit events to calculate the value if I enter something like "=2+2" and it gives me the answer when I tab away from the active textbox? -- I am running on Office 2003, unless otherwise stated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
on exit field | Excel Programming | |||
Exit Field vs Exit Button...... | Excel Programming | |||
macro on exit of field | Excel Programming | |||
Looping procedure calls userform; how to exit loop (via userform button)? | Excel Programming | |||
Userform Exit button | Excel Programming |