+ Reply to Thread
Results 1 to 10 of 10

Userform To Populate Next Blank Row-> Not Working

  1. #1
    jjward101
    Guest

    Userform To Populate Next Blank Row-> Not Working

    Good Morning! I created a userform, with code on the {Submit} button that *should* populate the next blank row across 6 columns.
    It is working for columns a,b,c but d,e,f do not seem to be getting the text that should be there. I spent over an hour last night trying
    to troubleshoot this, but I am at a brick wall.

    The code is:

    Private Sub CommandButton1_Click()

    ListRow = Cells(Rows.Count, 1).End(xlUp).Row
    Set firstEmptyRow = Range("A" & ListRow + 1)

    firstEmptyRow.Offset(0, 0).Value = TextBox1.Value 'Opp Name
    firstEmptyRow.Offset(0, 1).Value = TextBox2.Value 'Create Date
    firstEmptyRow.Offset(0, 2).Value = TextBox3.Value 'Book Date
    firstEmptyRow.Offset(0, 3).Value = TextBox4.Value 'Poject Number
    firstEmptyRow.Offset(0, 4).Value = TextBox5.Value 'Dollar Value
    firstEmptyRow.Offset(0, 5).Value = TextBox6.Value 'Secured Margin Rate
    End Sub


    What am i missing?

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,916

    Re: Userform To Populate Next Blank Row-> Not Working

    As far as I can see there's nothing really wrong with your code except that I'm missnig some dimensioning.
    I edited the code as follows and it does what ot shoud do
    Please Login or Register  to view this content.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,895

    Re: Userform To Populate Next Blank Row-> Not Working

    Try:
    Please Login or Register  to view this content.
    Change the sheet name (in red) to suit your needs.
    Last edited by Mumps1; 01-03-2022 at 09:59 AM.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  4. #4
    jjward101
    Guest

    Re: Userform To Populate Next Blank Row-> Not Working

    I know I must be missing something silly here, but still only the first three columns are populating with the text. I have attached the workbook, and would be grateful if you have a moment to take a look at it.
    Attached Files Attached Files

  5. #5
    jjward101
    Guest

    Re: Userform To Populate Next Blank Row-> Not Working

    Thank you. Oddly, this still didn't work. I posted the actual workbook below, if you have a chance to check it out I would be grateful.

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,916

    Re: Userform To Populate Next Blank Row-> Not Working

    of course it doesn't work.
    You're (I'm not aloowed to say these words out loud or in the open but you can fill in the spaces here ........) usig MERGED cells
    That's omething YOU will have to mention.

    First column is A, second colum is I third is M etc....

    Try figuring it out yourself now

  7. #7
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,342

    Re: Userform To Populate Next Blank Row-> Not Working

    Get rid of your merged cells.
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,895

    Re: Userform To Populate Next Blank Row-> Not Working

    Try the attached file. I have unmerged all the merged cells. You should avoid using merged cells at all cost because they almost always create problems for macros.
    Attached Files Attached Files

  9. #9
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,916

    Re: Userform To Populate Next Blank Row-> Not Working

    Hope the OP learns from this.

  10. #10
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,342

    Re: Userform To Populate Next Blank Row-> Not Working

    approach using structured table - eliminates the need to find range size/last row etc., - expands/contracts dynamically as you add/delete.
    Attached Files Attached Files

+ 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. [SOLVED] Basic Userform to populate sheet not working
    By Betsy Simpkins in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-09-2018, 02:55 PM
  2. [SOLVED] Excel stops working with Userform Textbox populate
    By Sintek in forum Excel Programming / VBA / Macros
    Replies: 52
    Last Post: 05-22-2018, 10:14 AM
  3. [SOLVED] VBA to populate range with textbox.value form UserForm keyboard input not working
    By Sintek in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-07-2016, 03:12 AM
  4. Replies: 2
    Last Post: 09-20-2013, 01:43 PM
  5. Userform - Stop Command button working if a textbox is blank?
    By revenge4ash89 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-10-2012, 05:52 AM
  6. Replies: 3
    Last Post: 08-11-2009, 09:45 AM
  7. detecting the first blank row in the spreadsheet and populate the blank row with data
    By racerrunner in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2006, 01:22 AM

Tags for this Thread

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