LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Adding data to a worksheet from a UserForm

Hello all, I am trying to get my head around adding data to a worksheet
via a userform. I want to add to lists in sheet 3 in the next available
row but I keep getting a application-defined or object defined error.
Debug points me to the 2nd line of the macro. (Set LastRow).
Can any one help? Thanks
Kezza

Private Sub CommandButton6_Click()
Dim LastRow As Object

Set LastRow = Sheet3.Range("a65536").End(x1Up)

LastRow.Offset(1, 0).Value = TextBox6.Text
LastRow.Offset(1, 1).Value = TextBox7.Text
LastRow.Offset(1, 2).Value = TextBox8.Text

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

If response = vbYes Then
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""

TextBox6.SetFocus

Else
Unload Me
End If
End Sub

 
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
UserForm Data to Worksheet maximillan Excel Programming 6 August 29th 06 10:35 AM
adding a worksheet causes main userform to corrupt Magius00 Excel Programming 4 October 26th 05 09:02 AM
Data from userform to worksheet koala[_15_] Excel Programming 0 October 9th 04 08:34 AM
Data from userform to worksheet koala[_13_] Excel Programming 0 October 9th 04 01:20 AM
data from userform into worksheet cells Newbie1 Excel Programming 2 February 9th 04 09:55 PM


All times are GMT +1. The time now is 08:15 AM.

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

About Us

"It's about Microsoft Excel"