PDA

View Full Version : Generating and populating a table based on list of values in another workbook.



ecalid
08-24-2023, 03:41 AM
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.

Aussiebear
08-24-2023, 03:56 AM
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

georgiboy
08-24-2023, 03:56 AM
If you are using Excel 365, you may be able to make use of the FILTER function as a formula option?

ecalid
08-24-2023, 04:25 AM
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.


31002

Paul_Hossler
08-24-2023, 05:58 AM
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)