Article ID: 184254
Article Last Modified on 1/22/2007
A1: Name B1: ID C1: Phone
Control Caption property
--------------------------
Label1 Name
Label2 ID
Label3 Phone
Control Caption property
---------------------------------
CommandButton1 Add Record
CommandButton2 Exit
Private Sub CommandButton1_Click()
Dim LastRow As Range
Dim response As Integer
Set LastRow = Sheet1.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text
LastRow.Offset(1, 2).Value = TextBox3.Text
MsgBox "One record written to Sheet1"
response = MsgBox("Do you want to enter another record?", _
vbYesNo)
If response = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox1.SetFocus
Else
Unload Me
End If
End Sub
Private Sub CommandButton2_Click()
End
End Sub
Sub Show_UserForm()
UserForm1.Show
End Sub
Additional query words: XL98
Keywords: kbhowto kbprogramming KB184254