harveya915
Board Regular
- Joined
- Sep 4, 2015
- Messages
- 141
I have a UserForm with 3 TextBoxes. I have a code (inside a Module2) that will find the sum of the contents of TextBox3 + TextBox4 = TextBox5. The code looks like this:
Then in the UserForm code I have:
Recently I made some changes to the UserForm. I added a CheckBox1 that when the value is True it adds 2 more TextBoxes to the UserForm (TextBox10 and TextBox11)
I need for when these new TextBoxes become visible for the following calculations:
TextBox3 + TextBox10 = TextBox11
Then
TextBox11 + TextBox4 = TextBox5
But if the CheckBox1 remains unchecked/False for the original equation to remain: TextBox3 + TextBox4 = TextBox5
VBA Code:
Sub SUM_CAL()
Dim X As Double
X = 0
If Len(UserForm1.TextBox3.Value) > 0 Then X = X + UserForm1.TextBox3.Value
If Len(UserForm1.TextBox4.Value) > 0 Then X = X + UserForm1.TextBox4.Value
UserForm1.TextBox5 = X
Then in the UserForm code I have:
VBA Code:
Private Sub TextBox3_Change()
Call Module2.SUM_CAL
End Sub
VBA Code:
Private Sub TextBox4_Change()
Call Module2.SUM_CAL
End Sub
Recently I made some changes to the UserForm. I added a CheckBox1 that when the value is True it adds 2 more TextBoxes to the UserForm (TextBox10 and TextBox11)
I need for when these new TextBoxes become visible for the following calculations:
TextBox3 + TextBox10 = TextBox11
Then
TextBox11 + TextBox4 = TextBox5
But if the CheckBox1 remains unchecked/False for the original equation to remain: TextBox3 + TextBox4 = TextBox5