Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default help with vba user form

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default help with vba user form

Hi Dave

it's XLUP
not X1UP

the letter L not the number 1

Cheers
JulieD

"Dave W" wrote in message
...
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?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default help with vba user form

you're welcome and thanks for the feedback

wrote in message
...
Thank you


-----Original Message-----
Hi Dave

it's XLUP
not X1UP

the letter L not the number 1

Cheers
JulieD

"Dave W" wrote in

message
...
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?



.



  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default help with vba user form

Thank you


-----Original Message-----
Hi Dave

it's XLUP
not X1UP

the letter L not the number 1

Cheers
JulieD

"Dave W" wrote in

message
...
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?



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I fill a cell in a user form from a selection on same form? Terry Tipsy Excel Discussion (Misc queries) 4 June 11th 07 02:59 PM
User form David Excel Programming 0 April 22nd 04 09:21 PM
I am looking to see if anybody has an equivalant user form to Outlooks CONTACT form BruceJ[_2_] Excel Programming 2 October 15th 03 05:28 PM
User Form SP Excel Programming 2 July 21st 03 11:34 PM


All times are GMT +1. The time now is 05:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"