+ Reply to Thread
Results 1 to 18 of 18

Populate new row in table from a form (not userform) on another worksheet

  1. #1
    Registered User
    Join Date
    08-09-2012
    Location
    California
    MS-Off Ver
    Excel 2013
    Posts
    18

    Populate new row in table from a form (not userform) on another worksheet

    I have a worksheet called 'Input' where the user enters data in various staggered fields (not in a table format). I want that data added as a new record (row) to another worksheet 'Data' that is a defined table. I've found various websites/posts that can add a row of data to another worksheet, but not VBA that will copy and paste new data from 1 worksheet in a non-table format to another worksheet that is in a table format. I would like to do this without a userform and maintain the Input worksheet for data entry.

    So, basically I need this series of actions to be completed:
    1. User enters data on the worksheet 'Input' form and clicks on a button Submit (also a button to Cancel), 2. Confirm completion of all mandatory fields (with error notice if not complete), 3. copy and paste the new data into the worksheet 'Data' by adding a new row to the existing named table 'tblData', 4. Clear the 'Input' worksheet fields for the next record entry. Any assistance would be greatly appreciated.

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

    Re: Populate new row in table from a form (not userform) on another worksheet

    Could you attach a copy of your file and explain in detail what you mean by
    Confirm completion of all mandatory fields (with error notice if not complete)
    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.

  3. #3
    Registered User
    Join Date
    08-09-2012
    Location
    California
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: Populate new row in table from a form (not userform) on another worksheet

    Attempted to upload file on 2 browsers (IE and Opera) without success. Not sure if you can help me with this situation.

    To answer the question, I'd like for the VBA to make sure that all mandatory fields are filled in prior to submission (copying and pasting) to the 'Data' table on another worksheet.

    I've attached screen shots of the 2 worksheets so you can get an idea of the format. If you have any input on how to attach the file, please let me know and I will upload right away.

    Thank you.

  4. #4
    Registered User
    Join Date
    08-09-2012
    Location
    California
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: Populate new row in table from a form (not userform) on another worksheet

    Sorry, forgot the attachments:

    Data Worksheet.JPGInput worksheet.JPG

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

    Re: Populate new row in table from a form (not userform) on another worksheet

    It's difficult to work with a picture. To attach your file, after you click "Reply to Thread", click on the "Go Advanced" button at the bottom right. Click "Manage Attachments". What are the mandatory fields?

  6. #6
    Registered User
    Join Date
    08-09-2012
    Location
    California
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: Populate new row in table from a form (not userform) on another worksheet

    Oh, sorry. Didn't realize there was a section below for attachments (new to this). Please see the workbook. Thank you.
    Attached Files Attached Files

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

    Re: Populate new row in table from a form (not userform) on another worksheet

    What are the mandatory fields? Do all the values in columns A, D, G and J in the Input sheet exist in row 3 of the Data sheet as headers?

  8. #8
    Registered User
    Join Date
    08-09-2012
    Location
    California
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: Populate new row in table from a form (not userform) on another worksheet

    E3:e13, e28

  9. #9
    Registered User
    Join Date
    08-09-2012
    Location
    California
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: Populate new row in table from a form (not userform) on another worksheet

    Column A was going to be used as a lookup tool so it's not part of the initial data entry. Eventually, I was going to add in a VLOOKUP Function to search if there was a previous identical entry.

    Columns D, G, and J are headers in the table 'tblData'.

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

    Re: Populate new row in table from a form (not userform) on another worksheet

    I have a macro for you to try out but I have encountered a problem. You said:
    Columns D, G, and J are headers in the table 'tblData'.
    In cell D3 of the Input sheet you have "S (Status)". This value is not in any cell in the header row 3 in sheet "Data". If any value in Columns D, G, and J of the "Input" sheet is not in row 3 of the "Data" sheet, the macro will not work. Can you please check to make sure that all the values in Columns D, G, and J of the "Input" sheet exist in row 3 of the "Data" sheet? The match has to be exact. Then please attach a revised file.

  11. #11
    Registered User
    Join Date
    08-09-2012
    Location
    California
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: Populate new row in table from a form (not userform) on another worksheet

    Do the fields in the Input sheet need to be consecutively ordered as they appear horizontally in the Data sheet? I.e. ReferralID followed by PID, followed by CDCR#, etc., or there just needs to be a match for every field on each sheet regardless of position or relation to each other?

    Again, thanks so much for taking the time to assist me. I am working on the edits now.

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

    Re: Populate new row in table from a form (not userform) on another worksheet

    They don't have to be consecutively ordered but they have to be an exact match.

  13. #13
    Registered User
    Join Date
    08-09-2012
    Location
    California
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: Populate new row in table from a form (not userform) on another worksheet

    Does there need to be a match on the Input sheet for every column in the Data sheet, or will the code run on just those fields where there is a match? Sorry for the additional questions, just want to make the best use of your time.

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

    Re: Populate new row in table from a form (not userform) on another worksheet

    In the Data sheet, there has to be a match for every value in Columns D, G, and J on the Input sheet. If there is a value in columns E, H and K that you don't want to copy to the Data sheet, then the corresponding value in Columns D, G, and J doesn't need to be matched. I hope that makes sense.

  15. #15
    Registered User
    Join Date
    08-09-2012
    Location
    California
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: Populate new row in table from a form (not userform) on another worksheet

    See attached. Confirmed all fields on Input sheet are identical to column headers on Data sheet. Thank you.
    Attached Files Attached Files

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

    Re: Populate new row in table from a form (not userform) on another worksheet

    Try the attached file. I had to modify a header (Target Discharge Date) in the Data sheet to match. Click the button on the Input sheet. You can try testing for mandatory cells by clearing some of the cells.
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    08-09-2012
    Location
    California
    MS-Off Ver
    Excel 2013
    Posts
    18

    [SOLVED]: Populate new row in table from a form (not userform) on another worksheet

    Mumps1, Thank you so much! I have spent hours trying to find this solution and you were able to provide it quickly and completely! Again, thank you.

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

    Re: [SOLVED]: Populate new row in table from a form (not userform) on another worksheet

    You are very welcome.

+ 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] 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
  2. [SOLVED] Userform calls other userform, then populate worksheet
    By Lehoi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2016, 06:50 PM
  3. [SOLVED] Excel - VBA Form - populate worksheet table with auto increment ID, worksheet headers only
    By EKExcel in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-17-2015, 03:15 AM
  4. [SOLVED] Userform: Load on Selection Change & Populate Form
    By daffodil11 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-13-2015, 06:34 PM
  5. Auto Populate Form With Selected Email In VBA Userform
    By Jeffrey34 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-18-2014, 07:56 AM
  6. [SOLVED] Single form to populate a table
    By Heat in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-05-2013, 09:17 PM
  7. Populate more than one worksheet from a user form
    By bigpee in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-20-2009, 09:14 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