+ Reply to Thread
Results 1 to 7 of 7

Pull Data from Sheet Based on Criteria -- Populate UserForm & ask for Missing Data

  1. #1
    Registered User
    Join Date
    08-08-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    12

    Pull Data from Sheet Based on Criteria -- Populate UserForm & ask for Missing Data

    This is beyond my current VBA expertise having never worked with userforms before and I can't find anything similar on the internet.

    I have a spreadsheet that is updated weekly -- but every week new info is added that needs a user to input corresponding info. I use a vlookup function to link to another spreadsheet that populates the info from previous weeks and the info that is missing shows up as #N/A...

    First I was using a msgbox function to get the info:

    HTML Code: 
    But it can be up to 30 different new employees... and that is time consuming.

    I would like to make it more user friendly by creating ONE userform that displays all of the employees as labels -- has a text box in which to put the ID # -- and then has a drop down box to choose the type of employee (2 options). I want all of that info to go back to the reference spreadsheet so it will be saved for following weeks, and then redo the vlookup to get the info into the new weekly spreadsheet (I can do that part)....

    I'm completely stumped on it though... the code I have so far is pitiful:

    HTML Code: 

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Pull Data from Sheet Based on Criteria -- Populate UserForm & ask for Missing Data

    Hi,

    It sounds like the proverbial sledgehammer/nut solution. It's not clear to me how using VBA and userforms is better than using Excel functions and drop down validation cells, perhaps with a little VBA to grab the starting information from the other workbook.

    I'd also consider carefully whether you need a separate workbook. Often these things are simpler if you keep everything in one workbook, and preferably on one sheet.

    Why not upload the workbook and explain with reference to specific ranges what you are trying to achieve.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    08-08-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Pull Data from Sheet Based on Criteria -- Populate UserForm & ask for Missing Data

    Hello --

    If I were the end user I would do it the way you say... however, I'm designing this for people who are not Excel proficient at all... and I've discovered (from previous projects) that the simpler I can make it for them, the less problems I have and the less they call me saying they are stuck.... hence the userform idea. The goal is for them not to have to do anything else in Excel other than literally open the file & press a button & enter the necessary info in the simplest most user-friendly way possible.

    I do have to have a separate workbook because we receive a new file every week from the client, so I cannot control what is in their file. I can only keep records from previous files to pull from. That part all works fine though -- I have that coded.

    I can't upload the sheet because it has confidential info unfortunately.

    I could... following your train of thought... is it possible to pause the macro -- let them enter the information directly into the sheet & then continue?

    Trust me when I say that the end result has to require VERY LITTLE knowledge of Excel for the end user even if it is more work for me at the beginning...

    Any suggestions are greatly appreciated!

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Pull Data from Sheet Based on Criteria -- Populate UserForm & ask for Missing Data

    Hi,

    I've designed many systems for applications similar to yours where the process falls into three basic areas. i.e.
    1. Grab data from some other system
    2. Allow the user to add new data in a controlled way, using drop down pick lists wherever possible
    3. Consolidate all data for reporting in some way.

    Rarely do I choose to use Userforms. In fact I used to use them fairly frequently in my early days of VBA coding, but over time I've moved away from that preferring the simpler route of using standard Excel functions and functionality, backed up where necessary with macros to automate processes like filtering or extracting data. I think there is just as much not more control available in Excel with judicious use of Sheet protection, locked cells, data validation and the like as you can get with UserForms. With many I don't allow the user any Excel input other than in those cells where I want an entry, and only when an entry should be available.

    If you can anonymise a stripped down copy of your workbook no doubt we can offer more definitive advice.

  5. #5
    Registered User
    Join Date
    08-08-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Pull Data from Sheet Based on Criteria -- Populate UserForm & ask for Missing Data

    Okay here is a stripped down version:

    Template File is the file we receive from client
    Template 2 is the file I have the previous weeks data in

    I use Template 2 to populate the ID info for new file received

    Then I need new employees (represented by the last line in Template File) to have their info updated in Template 2 & Template File by end user before the rest of the macro continues (purpose of macro by the way is to create ASCII file for upload into system to eliminate having to input time manually)

    Then it reformats and splits out the info into two separate ASCII files for upload into system (p.s. there are a lot more employees than on this sheet thus the macro)

    I still have to find a way to tell it which employees to put in the ACH batch because I wrote it one way yesterday but it was incorrect & now I have to redo it.

    Here is the code (please forgive me -- I am a novice --- don't judge too harshly!!)

    HTML Code: 
    Attached Files Attached Files

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Pull Data from Sheet Based on Criteria -- Populate UserForm & ask for Missing Data

    Hi,

    What you're trying to do is a fairly common task and can undoubtedly be achieved with a lot less coding.
    If you spell out the basic process step by step with reference to the two workbooks, and create a sample of the final output that you require we can no doubt come up with a simpler way.

    Is the file from which you're uploading data always in the same basic layout with the total column always in the same position?

  7. #7
    Registered User
    Join Date
    08-08-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Pull Data from Sheet Based on Criteria -- Populate UserForm & ask for Missing Data

    Attachment 297607Sure:

    Step 1: Reformat Template to eliminate unnecessary information (it is normally in the same format, but sometimes the column does change)
    Step 2: Vlookup ID # from Template 2 and input into Template & remove employees with 0 hours
    Step 3: Identify employees (new) that do not have an ID # and have user input their ID # & type of payment (regular or ACH) with minimal Excel knowledge
    Step 4: Put all new information entered into Template 2 & Template for next weeks use & use in this file
    Step 5: Split overtime into separate lines on spreadsheet in Template
    Step 6: All time must be changed to 4 digit format with no decimals (i.e. 40 hours = 4000 & .5 hours = 0050) in Template
    Step 7: Split information from Template into two separate files based on payment type -- ACH & Regular
    Step 8: Format & write both to ASCII file in Notepad for both files (this part the WritetoText part outputs exactly what I need it to look like at the end - file attached)Example of Final Product.txt
    Step 9: Save all & Close all


    Thank you so much for your assistance - I just started learning this a few months back so I'm still new to all of this & know I don't do things the best way
    Last edited by roxybethany; 02-15-2014 at 12:12 PM.

+ 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] Pull data from one sheet to another based on multiple criteria
    By thestalkycop in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-15-2014, 01:38 AM
  2. Pull ranked data from another sheet based on one cells criteria
    By murphyjeff08 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-19-2013, 11:51 AM
  3. Replies: 5
    Last Post: 07-23-2013, 01:17 PM
  4. Pull data from one sheet to another based on criteria
    By lowrymike in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-12-2013, 12:53 PM
  5. [SOLVED] Pull data from another sheet based on certain criteria
    By steve_sr2 in forum Excel General
    Replies: 1
    Last Post: 02-23-2006, 06:15 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