Could someone please solve this Excel User Form problem.
In the User Form I have a text box (TextBox1), a series of check boxes (ChechBox1, 2 & 3) and an execute button (CommandButton1). If a user checks boxes 1 and 3, I want adjacent cells to be filled with the relevant text. Unfortunately this routine ends at the first false return. I realise that it’s probably obvious but could you or someone please tell me why?
Private Sub CommandButton1_Click()
Dim xxx
xxx = TextBox1.Text
If CheckBox1.Value = True Then
ActiveCell.FormulaR1C1 = "1 " & xxx
ActiveCell.Offset(1, 0).Range("A1".Select
If CheckBox2.Value = True Then
ActiveCell.FormulaR1C1 = "2 " & xxx
ActiveCell.Offset(1, 0).Range("A1".Select
If CheckBox3.Value = True Then
ActiveCell.FormulaR1C1 = "3 " & xxx
ActiveCell.Offset(1, 0).Range("A1".Select
End If
End If
End If
End Sub
In the User Form I have a text box (TextBox1), a series of check boxes (ChechBox1, 2 & 3) and an execute button (CommandButton1). If a user checks boxes 1 and 3, I want adjacent cells to be filled with the relevant text. Unfortunately this routine ends at the first false return. I realise that it’s probably obvious but could you or someone please tell me why?
Private Sub CommandButton1_Click()
Dim xxx
xxx = TextBox1.Text
If CheckBox1.Value = True Then
ActiveCell.FormulaR1C1 = "1 " & xxx
ActiveCell.Offset(1, 0).Range("A1".Select
If CheckBox2.Value = True Then
ActiveCell.FormulaR1C1 = "2 " & xxx
ActiveCell.Offset(1, 0).Range("A1".Select
If CheckBox3.Value = True Then
ActiveCell.FormulaR1C1 = "3 " & xxx
ActiveCell.Offset(1, 0).Range("A1".Select
End If
End If
End If
End Sub