I need some help with a macro that could copy rows of data from an existing spreadsheet to a new one based on values in 1 column.
For example, the following table is the original spreadsheet.
ID
123 Data 1 Data 2 Data 3 Data 4 Data 5
156 Data 1 Data 2 Data 3 Data 4 Data 5
124 Data 1 Data 2 Data 3 Data 4 Data 5
167 Data 1 Data 2 Data 3 Data 4 Data 5
187 Data 1 Data 2 Data 3 Data 4 Data 5
143 Data 1 Data 2 Data 3 Data 4 Data 5
121 Data 1 Data 2 Data 3 Data 4 Data 5
175 Data 1 Data 2 Data 3 Data 4 Data 5
182 Data 1 Data 2 Data 3 Data 4 Data 5
I have, on another spreadsheet a list of ID numbers that I want from the original.
ie
ID
121
123
124
167
187
What I want to do is have excel compare the ID columns, and when it finds a match, to copy all the data in the original row to the new spreadsheet. ie
ID
121 Data 1 Data 2 Data 3 Data 4 Data 5
123 Data 1 Data 2 Data 3 Data 4 Data 5
124 Data 1 Data 2 Data 3 Data 4 Data 5
167 Data 1 Data 2 Data 3 Data 4 Data 5
187 Data 1 Data 2 Data 3 Data 4 Data 5
How would you go about doing this? Vlookup? how could you apply it so that it doesn't just grab the first value of the row and copy over the entire row?
For example, the following table is the original spreadsheet.
ID
123 Data 1 Data 2 Data 3 Data 4 Data 5
156 Data 1 Data 2 Data 3 Data 4 Data 5
124 Data 1 Data 2 Data 3 Data 4 Data 5
167 Data 1 Data 2 Data 3 Data 4 Data 5
187 Data 1 Data 2 Data 3 Data 4 Data 5
143 Data 1 Data 2 Data 3 Data 4 Data 5
121 Data 1 Data 2 Data 3 Data 4 Data 5
175 Data 1 Data 2 Data 3 Data 4 Data 5
182 Data 1 Data 2 Data 3 Data 4 Data 5
I have, on another spreadsheet a list of ID numbers that I want from the original.
ie
ID
121
123
124
167
187
What I want to do is have excel compare the ID columns, and when it finds a match, to copy all the data in the original row to the new spreadsheet. ie
ID
121 Data 1 Data 2 Data 3 Data 4 Data 5
123 Data 1 Data 2 Data 3 Data 4 Data 5
124 Data 1 Data 2 Data 3 Data 4 Data 5
167 Data 1 Data 2 Data 3 Data 4 Data 5
187 Data 1 Data 2 Data 3 Data 4 Data 5
How would you go about doing this? Vlookup? how could you apply it so that it doesn't just grab the first value of the row and copy over the entire row?