Hi forum members,
I hit a road block a few days ago with some code I have been writing. I have two sets of data that I am trying to combine, and I can combine them by using a unique identifier that I have in both lists. On my Result sheet, the unique identifier is a UPC (column D), and within one set of data it has Country (column I), Price (column J), and Sales Dates (column K). My other set of data I have on another sheet (Size), and it also has the UPC. I need to match up the UPCs to move the correct information from the Result sheet to the Size sheet, but the UPCs are not in the same order. See below for the example:
Result Sheet
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]UPC[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Country[/TD]
[TD]Price[/TD]
[TD]Date[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]USA[/TD]
[TD]10[/TD]
[TD]1/3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]CHINA[/TD]
[TD]20[/TD]
[TD]1/3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]USA[/TD]
[TD]25[/TD]
[TD]1/9[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]VIET NAM[/TD]
[TD]12[/TD]
[TD]1/8[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]SRI LANKA[/TD]
[TD]10[/TD]
[TD]1/1[/TD]
[/TR]
</tbody>[/TABLE]
Size Sheet
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD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]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I have tried looking in so many places to figure this out but I couldn't seem to find the answer. I want to be able to continue the code within VBA as I have information being moved from one sheet to the other (not being matched though, just copying and pasting by using column header names). I know I can do it easily with Match Index using formulas for one piece of information, but having multiple cells in different columns move from one to the other seems to have put me in a bad spot. Does anyone know of any tips to make this happen? I appreciate any feedback, thanks so much!
I hit a road block a few days ago with some code I have been writing. I have two sets of data that I am trying to combine, and I can combine them by using a unique identifier that I have in both lists. On my Result sheet, the unique identifier is a UPC (column D), and within one set of data it has Country (column I), Price (column J), and Sales Dates (column K). My other set of data I have on another sheet (Size), and it also has the UPC. I need to match up the UPCs to move the correct information from the Result sheet to the Size sheet, but the UPCs are not in the same order. See below for the example:
Result Sheet
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]UPC[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Country[/TD]
[TD]Price[/TD]
[TD]Date[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]1[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
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I have tried looking in so many places to figure this out but I couldn't seem to find the answer. I want to be able to continue the code within VBA as I have information being moved from one sheet to the other (not being matched though, just copying and pasting by using column header names). I know I can do it easily with Match Index using formulas for one piece of information, but having multiple cells in different columns move from one to the other seems to have put me in a bad spot. Does anyone know of any tips to make this happen? I appreciate any feedback, thanks so much!