Forum Discussion

tanman223's avatar
tanman223
Copper Contributor
Nov 07, 2022

Macro to find data from Table 1 and fill into Table 2 in another workbook

I have Table1 in a file that will continuously get populated with new manufacturing data. The rows are associated with a unique manufacturing lot in column A. The headers for this table are process parameters and have a unique name to each. Table2 in another workbook needs to be populated as data in Table1 in entered (could update on demand by click of a macro button or automate to occur at a certain time every day).

 

Additionally, Table2 has more parameter columns than Table1, so the macro should only populate data into the columns where there is a match for the column name. Remaining Table2 columns are either calculations or pulling data from yet another Excel database.

 

I can create references and vlookups, but the columns number in the hundreds and that would leave too many opportunities to break. Is there a simple macro that I could create and run (I have limited experience)? In the case where column names do not match due to future changes, could I create another table which could be more easily maintained to make links between the columns (eg, Table1 "Start of Batch" = "Table2 "Batch Initiation")?

 

Also, the batches (rows of data) may be not be in the same order in each table and Table2 may list batches that were not included in Table1, therefore I am not looking to copy/paste entire columns of data.

 

I was thinking something like:

For Table1,Batch276,Parameter1 ; Find column Parameter1 in Table2 and enter value into row for Batch276. 

Then loop for all columns.

No RepliesBe the first to reply

Resources