+ Reply to Thread
Results 1 to 5 of 5

Userform not saving to next empty row on spreadsheet

  1. #1
    Registered User
    Join Date
    07-29-2016
    Location
    dallas, tx
    MS-Off Ver
    365
    Posts
    51

    Userform not saving to next empty row on spreadsheet

    I've had my userform up and running error free for several months now, but I have discovered a problem that hadn't presented itself earlier. My coworkers have been using this form, which saves to 41 columns on the spreadsheet. Never has just one field on the userform been completed and then saved. There's always been multiple fields completed on the userform and then saved successfully to the next empty row.

    What I noticed today is that if I complete only one field and then save, it will save over itself on the same row on the worksheet repeatedly. This only applies to all the fields except the one that is saved to Column 1. I can complete that first field only (saved to Column 1) on the userform and hit the command button to save and enter a new userform and it will save each time to the next empty row. However, if I completed, as an example, the field that is to be saved to Column 5 and no other field on the user form it will keep replacing the text in Column 5 on the same row. I've looked at so many sites for answers and it appears my code is right, but obviously it's not and I just can't see what the problem is.

    Here is a sample of my code:

    Please Login or Register  to view this content.
    Last edited by katiedee1625; 01-30-2017 at 10:56 PM.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Userform not saving to next empty row on spreadsheet

    katie,

    Please look at the forum rules, rule 3 tells you how and why to use code tags. Thank You ... if you would, please edit your post to suit?
    The issue is that the lastrow is established by looking at column 1, which may not always be the one with the highest row number with information.
    I assume since your code only has 5 items posting that you have shortened your code... no matter, the code below in red is the part that matters, it would check every column and ensure that the data (even 1 box) is placed in the next row that is blank in all related columns:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    07-29-2016
    Location
    dallas, tx
    MS-Off Ver
    365
    Posts
    51

    Re: Userform not saving to next empty row on spreadsheet

    Thank you for your reply. I applied the changes, but now none of the data is going to the spreadsheet. I understand your explanation, but can't seem to troubleshoot. I just don't know why none of the fields are going to the columns. Thoughts?

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,471

    Re: Userform not saving to next empty row on spreadsheet

    .
    I assume from your coding that you understand the correct syntax. Here is an example from one of my projects that works flawlessly.
    You should be able to change the Textbox names, etc and make your project work as desired.

    Please Login or Register  to view this content.

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,549

    Re: Userform not saving to next empty row on spreadsheet

    Like this.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

+ 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] Saving data from UserForm to spreadsheet
    By katiedee1625 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-18-2016, 11:35 AM
  2. [SOLVED] Cell w/link formula to show as empty for VBA check before saving
    By thecdnmole in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-23-2014, 04:30 PM
  3. [SOLVED] Userform: How do I use text/values from a spreadsheet to customize the userform?
    By bananajelly in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-14-2014, 03:47 PM
  4. Replies: 3
    Last Post: 08-20-2013, 04:19 PM
  5. Saving excel spreadsheet via userform
    By kieranbop in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-13-2011, 09:34 AM
  6. Saving to text file - tabs from empty cells ignored
    By lif in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-20-2006, 11:51 AM
  7. Saving a spreadsheet without saving the Macro
    By tedd13 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-31-2006, 09:20 AM

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