+ Reply to Thread
Results 1 to 9 of 9

Information from userform overwriting data previously entered by same userform

  1. #1
    Registered User
    Join Date
    12-12-2013
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    92

    Information from userform overwriting data previously entered by same userform

    Hi,

    I have been using a userform to submit data into a log. On occasion when I submit the log the information from the userform overwrites the previously entered information from minutes before. Any thoughts as to why or how this would happen? Also if there is something wrong with my code below please, if you can fix it, let me know.
    Please Login or Register  to view this content.

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Information from userform overwriting data previously entered by same userform

    I can't tell for sure, but something that I'm curious about is this.
    You have this statement and another one farther down that looks similar but references sheet5

    Please Login or Register  to view this content.
    What's the tab name of these sheets and why do they need to be activated?
    You start a with statement but don't seem to be using it. You say with sheets ("log"), but then keep referring to sheet("log") by name?
    You do the same with sheets("work").
    Last edited by skywriter; 03-19-2015 at 04:44 PM.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Registered User
    Join Date
    12-12-2013
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Information from userform overwriting data previously entered by same userform

    Thank you for the reply. The userform asks if there is additional work that needs to be completed. If the box is checked the information will feed to the work tab, and the log tab. The log tab is a running list of information. The work tab is for anything that needs additional work. Hope that makes sense.

  4. #4
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Information from userform overwriting data previously entered by same userform

    Okay I guess I wasn't clear, my fault.
    You have these two statements.
    Sheet4.Activate
    Sheet5.Activate
    What are the tab names of these sheets?

    Quote Originally Posted by ciresuark View Post
    Thank you for the reply. The userform asks if there is additional work that needs to be completed. If the box is checked the information will feed to the work tab, and the log tab. The log tab is a running list of information. The work tab is for anything that needs additional work. Hope that makes sense.

  5. #5
    Registered User
    Join Date
    12-12-2013
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Information from userform overwriting data previously entered by same userform

    Sheet 4 is the Log and sheet 5 is Work. Sorry for the confusion.

  6. #6
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Information from userform overwriting data previously entered by same userform

    Try this and see if it works. Save your old code just in case. You might just want to try this on a copy of your workbook to make sure everything is okay first. I can't be sure how well this will work without having your actual sheet to test it on. If you still have problems and can share the workbook that would be better.

    Here's what I am thinking.
    If old data is getting overwritten that tells me the problem may lie in the way your code is determining which row is the last row with data.
    Your code is using the COUNTA function on Column A, which counts non blank cells, if you have blank cells somewhere in your data in Column A this may cause issues. I used a technique that goes down to the very bottom of the worksheet in Column A and comes back up and stops when it hits a cell that is not blank. There may still be problems with this because I can't see your data and I don't know if Column A gets data every time, if not and one of the other columns always gets data we should switch to that column when determining the last data row. In other words in the last row of your data Column A doesn't have an entry for some reason but Column B etc does. Then the next set of data will overlap by one row.


    Please Login or Register  to view this content.
    Last edited by skywriter; 03-20-2015 at 12:09 PM.

  7. #7
    Registered User
    Join Date
    12-12-2013
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Information from userform overwriting data previously entered by same userform

    Thank you for the reply. There will always be content in column A so what you're proposing may work. I will give it a try.

  8. #8
    Registered User
    Join Date
    12-12-2013
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Information from userform overwriting data previously entered by same userform

    It seems to work. The issue only happened once in a while, but when it did it would last for a few hours. I will continue to try with this code and solve the thread.

    Thank you for your help.

  9. #9
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Information from userform overwriting data previously entered by same userform

    My pleasure.

+ 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: 13
    Last Post: 01-13-2014, 11:50 AM
  2. combining chart userform and data transfer userform into 1 userform
    By H_Kennedy in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-04-2014, 07:11 AM
  3. Populating VBA userform and Fetch previously entered data edit and make new entry
    By vijaynadiad in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-07-2013, 11:59 AM
  4. Open a excel userform with values previously entered by user using VBA
    By anuraag1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-17-2013, 07:02 AM
  5. [SOLVED] Data previously entered on UserForm dissappears, but still stored on worksheet - Excel VBA
    By eemiller1997 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-19-2012, 12:24 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