Hello Excel/VBA experts,
I am very inexperienced in VBA and wanted to run an idea across you to see if you could provide input on feasibility or to improve upon it with capabilities I may not be aware of. (I already looked, but if you can find something similar to this in another thread, please direct me there. And if you could provide sample code would be a huge bonus. )
There are two types of workbooks:
Workbook 1:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]UID[/TD]
[TD]Qty[/TD]
[TD]Price[/TD]
[/TR]
[TR]
[TD]0001[/TD]
[TD]15[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0005[/TD]
[TD]23[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0013[/TD]
[TD]12[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0124[/TD]
[TD]12[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Workbook 2:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]UID[/TD]
[TD]Qty[/TD]
[TD]Price[/TD]
[/TR]
[TR]
[TD]0001[/TD]
[TD]3[/TD]
[TD]1.25[/TD]
[/TR]
[TR]
[TD]0005[/TD]
[TD]4[/TD]
[TD].05[/TD]
[/TR]
</tbody>[/TABLE]
What I'd like to do is for each row in workbook 1, do a vlookup for the corresponding UID in workbook 2 and return the price value. This part is pretty simple.
The parts I'm not sure about:
1) Let's say I had a folder full of workbooks like workbook 2. Can I get a macro to go through each of the workbooks and do the vlookup function? Meaning it would go to Row 1 of workbook 1, look up that UID in workbook 2a return a price. Go to row 2 of workbook 1, lookup that UID in workbook 2a, but not find anything. Then it would try to find the row 2 UID in workbook 2b (located in the same folder as 2a).
2) If there are multiple instances of the UID existing in the workbook 2 folder, can I get a macro to choose the lowest price value or overwrite the higher value that is already in workbook 1 price column?
Any help would be greatly appreciated, thanks in advance!
I am very inexperienced in VBA and wanted to run an idea across you to see if you could provide input on feasibility or to improve upon it with capabilities I may not be aware of. (I already looked, but if you can find something similar to this in another thread, please direct me there. And if you could provide sample code would be a huge bonus. )
There are two types of workbooks:
Workbook 1:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]UID[/TD]
[TD]Qty[/TD]
[TD]Price[/TD]
[/TR]
[TR]
[TD]0001[/TD]
[TD]15[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0005[/TD]
[TD]23[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0013[/TD]
[TD]12[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0124[/TD]
[TD]12[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Workbook 2:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]UID[/TD]
[TD]Qty[/TD]
[TD]Price[/TD]
[/TR]
[TR]
[TD]0001[/TD]
[TD]3[/TD]
[TD]1.25[/TD]
[/TR]
[TR]
[TD]0005[/TD]
[TD]4[/TD]
[TD].05[/TD]
[/TR]
</tbody>[/TABLE]
What I'd like to do is for each row in workbook 1, do a vlookup for the corresponding UID in workbook 2 and return the price value. This part is pretty simple.
The parts I'm not sure about:
1) Let's say I had a folder full of workbooks like workbook 2. Can I get a macro to go through each of the workbooks and do the vlookup function? Meaning it would go to Row 1 of workbook 1, look up that UID in workbook 2a return a price. Go to row 2 of workbook 1, lookup that UID in workbook 2a, but not find anything. Then it would try to find the row 2 UID in workbook 2b (located in the same folder as 2a).
2) If there are multiple instances of the UID existing in the workbook 2 folder, can I get a macro to choose the lowest price value or overwrite the higher value that is already in workbook 1 price column?
Any help would be greatly appreciated, thanks in advance!