Consulting

Results 1 to 5 of 5

Thread: Generating and populating a table based on list of values in another workbook.

  1. #1
    VBAX Regular
    Joined
    Mar 2023
    Posts
    28
    Location

    Generating and populating a table based on list of values in another workbook.

    Good morning all,

    I am just wondering if there is a way of being able to select from a drop down menu, multiple criteria, for example Dropdown A and Dropdown B, get VBA to then lookup specified columns in another workbook, and then generate a table and populate it with the data found in those columns.

    So if there were 40 entries with a specific text in workbook B; "Lamination" in Dropdown A, and then specific text; "FLT driver" in Dropdown B on workbook A, it would generate a table and populate 40 rows in workbook A with the findings in both of those columns in workbook B.


    I have tried to use indexing excel code for this but it just isn't practical and the code often gets confused with it's self and brings up multiple entries.

    Any advice you can provide will be helpful.

    Thanks in advance.

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    Are you open to the concept of filtering a data table? Keeps it all in one workbook even one sheet if you wanted to.

    Simple example of filtering using two criteria

    Sub FilterByTwoColumns()
    With Range("A1")
    .AutoFilter Field:= 4, Criteria:= "Lamination"   ' change Field:= ? to suit the column
    .AutoFilter Field:= 8, Criteria:= "FLT driver"   ' change Field:= ? to suit second column
    End With
    End Sub
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,198
    Location
    If you are using Excel 365, you may be able to make use of the FILTER function as a formula option?
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved
    Click here for a guide on how to upload a file with your post

    Excel 365, Version 2403, Build 17425.20146

  4. #4
    VBAX Regular
    Joined
    Mar 2023
    Posts
    28
    Location
    Hi all, thanks for your replies.

    The excel document in which the information will be pulled from is not dynamic in the sense that it can be opened and manipulated. It is a huge list of employees and it can really only be used solely to feed information from as the generated table will be formatted into a user freindly form, able to print for multiple employees to sign.

    Also the resulting document needs to be a new document which is generated and then saved by the user. I've attached a copy of our table below, workbook B; I have to manually input all information in this table but need this to be populated by the information in workbook A.


    test.jpg

  5. #5
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    Personally I'd find it easier to visual the work flow if you could attach WB A and WB B samples (small sample, no sensitive data)
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •