trickdos,
The following is code that I came up with, but what you want is rreally
more than what you asked for. This will do as you asked.
Charles
Private Sub CommandButton1_Click()
With UserForm1
If .TextBox1.Value = "" Then
MsgBox " You must enter a name"
..TextBox1.SetFocus
Exit Sub
ElseIf .TextBox2.Value = "" Then
MsgBox " You must enter age"
..TextBox2.SetFocus
Exit Sub
ElseIf .TextBox3.Value = "" Then
MsgBox " You must enter gender"
..TextBox3.SetFocus
Exit Sub
End If
Range("A1").Value = .TextBox1.Text
Range("A2").Value = .TextBox2.Text
Range("A3").Value = .TextBox3.Text
..TextBox1 = ""
..TextBox2 = ""
..TextBox3 = ""
Unload UserForm1
End With
End Sub
---
Message posted from
http://www.ExcelForum.com/