+ Reply to Thread
Results 1 to 5 of 5

Code error: Wont submit data from userform to seperate sheet and new line

Hybrid View

  1. #1
    Registered User
    Join Date
    12-16-2013
    Location
    London, England
    MS-Off Ver
    MSO 2010
    Posts
    52

    Code error: Wont submit data from userform to seperate sheet and new line

    The below code should copy the details from my user form to the next available row on a seperate sheet, it currently is not coming working, it is not coming up with an error but also not working, can anyone spot the problem.


    ------------------------


    UserForm1.Hide
    
    
       Dim rw As Long
     
       With Sheets("Amends")
     
          'get the next avialable row in Sheet1
          rw = .Range("A" & .Rows.Count).End(xlUp).Row + 1
     
          'put the text box values in this row
    .Range("A" & rw).Value = ComboBox8.Value
    .Range("B" & rw).Value = TextBox19.Value
    .Range("C" & rw).Value = ComboBox1.Value
    .Range("F" & rw).Value = ComboBox2.Value
    .Range("G" & rw).Value = ComboBox3.Value
    .Range("L" & rw).Value = ComboBox6.Value
    .Range("M" & rw).Value = ComboBox7.Value
    .Range("D" & rw).Value = TextBox3.Value
    .Range("E" & rw).Value = TextBox4.Value
    .Range("H" & rw).Value = TextBox7.Value
    .Range("I" & rw).Value = TextBox8.Value
    .Range("N" & rw).Value = TextBox13.Value
    .Range("O" & rw).Value = TextBox14.Value
    .Range("P" & rw).Value = TextBox15.Value
    .Range("Q" & rw).Value = TextBox16.Value
    .Range("R" & rw).Value = TextBox17.Value
    .Range("S" & rw).Value = TextBox18.Value
    .Range("K" & rw).Value = TextBox9.Value
     
          Application.CutCopyMode = False
       End With
    
    Dim lngWriteRow As Long
    
    Dim ws As Worksheet
    Set ws = Worksheets("Amends")
    
    lngWriteRow = ws.Cells(Rows.Count, 2) _
    .End(xlUp).Offset(1, 0).Row
    
    If lngWriteRow < 13 Then lngWriteRow = 13
    
    ThisWorkbook.Save
    UserForm1.Hide
    
    End Sub
    Last edited by mwinter; 02-07-2014 at 08:35 AM. Reason: Forum Moderator

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Code error: Wont submit data from userform to seperate sheet and new line

    How are you calling this code?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    12-16-2013
    Location
    London, England
    MS-Off Ver
    MSO 2010
    Posts
    52

    Re: Code error: Wont submit data from userform to seperate sheet and new line

    Im not sure i understand?

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    How is the code being run?

  5. #5
    Registered User
    Join Date
    12-16-2013
    Location
    London, England
    MS-Off Ver
    MSO 2010
    Posts
    52

    Re: Error in code: HELP

    I fixed the formatting problems.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 11-15-2013, 05:03 PM
  2. VBA Code...error = run time error 1004 autofilter method of range class failed
    By Dariusd7 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-15-2013, 04:49 PM
  3. [SOLVED] Getting Error 1004 Object or Application Defined Error - Code to rearrange data
    By BlazzedTroll in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 06-10-2013, 12:10 PM
  4. [SOLVED] Range error in code, runs alone but not inside my full program, giving runtime error 1004
    By charizzardd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-23-2012, 03:34 PM
  5. Error 424 Object Required Error when Using AddItem to ListBox Generated in Code
    By jclark419 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-01-2010, 12:47 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1