help with vba user form

D

Dave W

I am learning how to add a user form
I'm following a knowledge base article # 213749

I've set up the user form
every thing seems to be right except
I'm getting an compile error message at

Set LastRow = Sheet1.Range("A65536").End(x1Up)

Here is the code from the instructions:

Private Sub CommandButton1_Click()

Dim LastRow As Object

Set LastRow = Sheet1.Range("A65536").End(x1Up)

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 sheet 1"

response = MsgBox("Do you want to enter another
record?", vbYesNo)

If response = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox.Text = ""

TextBox1.SetFocus

Else
Unload Me
End If


End Sub

Private Sub CommandButton2_CLick()
End

End Sub
Can anyone tell me what's wrong
Is there a mistake in the code or am I doing something
wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top