+ Reply to Thread
Results 1 to 6 of 6

Copy data from previous row into new row IF user form textboxes are not populated

  1. #1
    Registered User
    Join Date
    02-19-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    3

    Copy data from previous row into new row IF user form textboxes are not populated

    Hi Everyone,

    I am new to User form and to this forum.
    Before I even begin with my problem, I wish to thank everyone for their contributions that have helped to come this far as a newbie (especially the Excel programming geniuses).

    I have designed a simple user form to populate a finding tracker spreadsheet.
    Updating the tracker works fine.
    Although I only need to update certain textboxes in the user form, I find myself having to enter the same data in every textbox so that the next row of the spreadsheet is filled. In all cases, if a textbox is not updated for the next row, then the data should copy the data from the previous row.

    For example, last data Transferred from the user form are as follows:

    [Heading] Col A - Col B - Col C
    [Row 1] Apple - Red - 10

    Assuming I would only update the textbox for Col C in the user form, the next row in my spreadsheet would look like this:

    [Heading] Col A - Col B - Col C
    [Row 1} Apple - Red - 10
    [Row 2] (empty) - (empty) - 20

    As such, I would like to add a code that allows the data (Apple and Red in Col A and Col B) from the previous row to be copied automatically and only updates Col C with the new value 20.

    Oh, I should add that I have mostly Textbox values (about 20 columns) in the spreadsheet with the exception of three columns with CheckBox values although I can always repeat the checkbox fields.

    Super thanks in advance.

    syl
    Last edited by syl127; 02-19-2014 at 07:07 PM. Reason: formatting

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Copy data from previous row into new row IF user form textboxes are not populated

    Welcome to the forum syl!

    It might be easier to make small changes to what you have in order to get the functionality you're asking for. Could you post the code you're using to input what you have?
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Registered User
    Join Date
    02-19-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Copy data from previous row into new row IF user form textboxes are not populated

    Hi Solus,

    Thanks thanks thanks for your reply.

    Here's the code:


    Please Login or Register  to view this content.

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Copy data from previous row into new row IF user form textboxes are not populated

    Try changing your transfer sub to this:
    Please Login or Register  to view this content.
    I wasn't able to test yet.
    Last edited by Solus Rankin; 02-24-2014 at 09:52 AM.

  5. #5
    Registered User
    Join Date
    02-19-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Copy data from previous row into new row IF user form textboxes are not populated

    Hi Solos

    This is super! Will test and let you know! Big thanks!

  6. #6
    Registered User
    Join Date
    02-19-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Copy data from previous row into new row IF user form textboxes are not populated

    Hi Soros
    I tested the code and it worked like a charm! Super duper thanks!
    Syl

  7. #7
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Copy data from previous row into new row IF user form textboxes are not populated

    Glad to help! And again welcome to the forum.

    If you are happy with the solution please mark the thread as [SOLVED] using the thread tools at the top.

    And with any thread, you can show your appreciation to anyone who has helped you by clicking the * below their post.

+ 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. Can't leave empty date textboxes on user form when using CDate
    By JTResearch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-20-2013, 11:37 AM
  2. grouping multiple textboxes on a user form
    By Obfuscated in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-27-2013, 05:31 PM
  3. Can a command button make textboxes dissapear from a user form
    By shakey775 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-19-2012, 03:01 AM
  4. Formatting alignment in User Form Textboxes
    By ChemistB in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2011, 01:06 PM
  5. retrive data from spreadsheet on PREVIOUS and NEXT commands in User Form
    By krish_kg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2009, 05:17 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