T
trickdos
I am trying to put a function into this user box so that if one of th
textboxes are empty, then nothing gets entered into the sheet. Ca
anyone help? I am stumped. I greatly appreciate it.
Private Sub OK_Click()
'This all happens when OK is clicked.
'if the first textbox is blank, then a message box pops up
'to tell you a value must be entered.
If TextBox1 = "" Then MsgBox "you must enter a name"
Range("a1") = TextBox1.Value
If TextBox2 = "" Then MsgBox "you must enter an age"
Range("a2") = TextBox2.Value
If TextBox3 = "" Then MsgBox "you must enter a gender"
Range("a3") = TextBox3.Value
'clears the text boxes for next use
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
'sets the cursor in textbox1
TextBox1.SetFocus
'hides the userform when ok is clicked
Me.Hide
End Su
textboxes are empty, then nothing gets entered into the sheet. Ca
anyone help? I am stumped. I greatly appreciate it.
Private Sub OK_Click()
'This all happens when OK is clicked.
'if the first textbox is blank, then a message box pops up
'to tell you a value must be entered.
If TextBox1 = "" Then MsgBox "you must enter a name"
Range("a1") = TextBox1.Value
If TextBox2 = "" Then MsgBox "you must enter an age"
Range("a2") = TextBox2.Value
If TextBox3 = "" Then MsgBox "you must enter a gender"
Range("a3") = TextBox3.Value
'clears the text boxes for next use
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
'sets the cursor in textbox1
TextBox1.SetFocus
'hides the userform when ok is clicked
Me.Hide
End Su