VBA: cut/paste orders into different files based on common/duplicate IDs

rubyb

New Member
Joined
Mar 26, 2014
Messages
18
Hi all,

I am very new to VBAs and macros and am not quite comfortable with them, but a new school project requires their use (I think!). I have looked at many other threads posing similar questions, but none of the solutions seem to fit my needs...

This is the deal: my project requires me to look at raw data and automatically have it sort into different files based on if there is is a duplicate entry in a specific column. This is an example of the raw data (dummy data and titles); assume that it is in a file called "raw data.xlsx":
Order date Expected deliveryProductProduct codePrice$QuantityTotalBuyer ID
14-09-01

<!--StartFragment--> <colgroup><col width="65" style="width:65pt"> </colgroup><tbody>
</tbody>
14-09-07

<!--StartFragment--> <colgroup><col width="65" style="width:65pt"> </colgroup><tbody>
</tbody>
98476BETAx30312001212400
123ZXY

<!--StartFragment--> <colgroup><col width="65" style="width:65pt"> </colgroup><tbody>
</tbody>
14-09-0414-09-1034876ZETAq41000141400678TUV
14-09-0414-09-1034877WARK38753530625678TUV
14-09-1014-09-1518983BETA3045004723500432LKN
14-09-1914-09-2058302NOVAs2115001522500987EWW
14-09-1914-09-2058305
ZETAqa

<tbody>
</tbody>
10001919000987EWW
14-09-2014-09-2820394BLOMz12000918000567ABC
14-09-2114-10-0198477
ZETAq4

<tbody>
</tbody>


<colgroup><col width="65" style="width:65pt"></colgroup><tbody>
</tbody>
10002525000302WLU

<tbody>
</tbody>


So what I need to do is to have a macro be able to identify if there are any duplicates in Column H/Buyer ID, and then have this row be cut and pasted (NOT simply copied and pasted) into another file, called "Multiple orders.xlsx". Essentially the point of the project is to be able to identify if any buyers are making more than one purchase per order.

I know how to do this manually, i.e.: find duplicates with conditional formatting and then cut/paste manually. However, I want to be able to automate this so that time is saved and the chance of errors is reduced.

Please let me know if something doesn't make sense… Any help would be much appreciated!
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,215,063
Messages
6,122,928
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top