dss28
Board Regular
- Joined
- Sep 3, 2020
- Messages
- 165
- Office Version
- 2007
- Platform
- Windows
In my user form I want to perform mathematical equation based on selection of one of option button (from 4 option buttons) and a check box.
The purpose of selecting one of four option buttons is to perform mathematical calculation based one of four equations.
The checkbox selection defines whether a mathematical calculation is to be performed or not. it uses the value in TextBox115, TextBox130 and TextBox160.
After entering a value in TextBox115, the result of mathematical calculation based on selection of option button and checkbox should appear in TextBox8
If only option button is selected without checkbox selection then it should perform multiplication of value in TextBox115 and TextBox114 and display result in TextBox8.
the code i am trying is enclosed.
other issue i am seriously facing in this form is that of not enough memory to display the form. Dont know if it is because the form contains many textboxes , command buttons etc. total of more than about 240 items.
please guide
The purpose of selecting one of four option buttons is to perform mathematical calculation based one of four equations.
The checkbox selection defines whether a mathematical calculation is to be performed or not. it uses the value in TextBox115, TextBox130 and TextBox160.
After entering a value in TextBox115, the result of mathematical calculation based on selection of option button and checkbox should appear in TextBox8
If only option button is selected without checkbox selection then it should perform multiplication of value in TextBox115 and TextBox114 and display result in TextBox8.
the code i am trying is enclosed.
other issue i am seriously facing in this form is that of not enough memory to display the form. Dont know if it is because the form contains many textboxes , command buttons etc. total of more than about 240 items.
please guide
VBA Code:
Private Sub TextBox115_Change()
If UserForm38.OptionButton1.Value = True Then 'equation 1
If UserForm38.CheckBox1.Value = True Then
UserForm38.TextBox8.Value = Format((UserForm38.TextBox115.Value * 0.01) * UserForm38.TextBox114.Value / (UserForm38.TextBox130.Value * (100 - UserForm38.TextBox160.Value)), "0.000")
'
'Else
''End
End If
If UserForm38.OptionButton2.Value = True Then equation 2
If UserForm38.CheckBox1.Value = True Then
UserForm38.TextBox8.Value = Format((UserForm38.TextBox115.Value * 0.002) * UserForm38.TextBox114.Value / (UserForm38.TextBox130.Value * (100 - UserForm38.TextBox160.Value)), "0.000")
' Else
' End
End If
If UserForm38.OptionButton3.Value = True Then equation 3
If UserForm38.CheckBox1.Value = True Then
UserForm38.TextBox8.Value = Format((UserForm38.TextBox115.Value * 0.001) * UserForm38.TextBox114.Value / (UserForm38.TextBox130.Value * (100 - UserForm38.TextBox160.Value)), "0.000")
' Else
' End
End If
If UserForm38.OptionButton1.Value = True Then ' equation 4
If UserForm38.CheckBox1.Value = True Then
UserForm38.TextBox8.Value = Format((UserForm38.TextBox115.Value * 0.1) * UserForm38.TextBox114.Value / (UserForm38.TextBox130.Value * (100 - UserForm38.TextBox160.Value)), "0.000")
' Else
End If
If UserForm38.OptionButton1.Value = True Then ' equation 5
UserForm38.TextBox8.Value = Format((UserForm38.TextBox115.Value * UserForm38.TextBox114.Value *0.01), "0.000") ' no checkbox selected
End If
End If
End If
End If
End If
End
End Sub