Hi everyone,
I have two textboxes and one combobox on a multipage page. I'm trying to get vba to autofill the third textbox when either the first textbox or the combox change but for obvious reasons below, I can only get it to update when I change the first textbox. Is it possible to have two events in the private sub or am I going about this the wrong way?
I have two textboxes and one combobox on a multipage page. I'm trying to get vba to autofill the third textbox when either the first textbox or the combox change but for obvious reasons below, I can only get it to update when I change the first textbox. Is it possible to have two events in the private sub or am I going about this the wrong way?
Code:
Private Sub TextBox1_Change()
Dim i As Integer
i = Val(TextBox1)
If ComboBox2.Value = "man" Then
TextBox2.Value = i * 50
ElseIf ComboBox2.Value = "woman" Then
TextBox2.Value = i * 60
ElseIf ComboBox2.Value = "boy" Then
TextBox2.Value = i * 70
ElseIf ComboBox2.Value = "girl" Then
TextBox2.Value = i * 80
ElseIf ComboBox2.Value = "dog" Then
TextBox2.Value = i * 90
ElseIf ComboBox2.Value = "cat" Then
TextBox2.Value = i * 100
ElseIf ComboBox2.Value = "Senior Director" Then
TextBox2.Value = i * 160
End If
End Sub