VBA Code to Copy Unique row from worksheet to worksheet

purceld2

Well-known Member
Joined
Aug 18, 2005
Messages
586
Office Version
  1. 2013
Platform
  1. Windows
Hi All
I have been sweeping the internet to find some vba code that compares columns, in my case columns A, D, E, F to find unique rows then append it to the bottom of the Master Spreadsheet.

All I have managed to find is code that just copies the data from spreadsheet to spreadsheet.

Below is examples of the spreadsheet

Master Spreadsheet (to be appended to)

Perry Hill Territory Spreadsheet.xlsm
ABCDEFGHIJ
2TerritoryTerritory NameCampaignPublisherAssignedReturnedDays AssignedLast AllocatedStatusNotes
31Dacres Road2John Doe 116/04/201616/05/2016301981OK
41Dacres Road1John Doe 222/04/201618/05/2016261979OK
51Dacres RoadJohn Doe 322/04/201608/07/2016771928Overdue
61Dacres RoadJohn Doe 411/05/201627/06/2016471939Overdue
71Dacres RoadJohn Doe 514/05/201625/06/2016421941Overdue
81Dacres RoadJohn Doe 620/05/201604/07/2016451932Overdue
91Dacres RoadJohn Doe 701/06/201620/07/2016491916Overdue
101Dacres RoadJohn Doe 803/06/201601/07/2016281935OK
111Dacres RoadJohn Doe 903/06/201608/07/2016351928Overdue
121Dacres RoadJohn Doe 1008/06/201613/07/2016351923Overdue
131Dacres RoadJohn Doe 1111/06/201616/08/2016661889Overdue
141Dacres RoadJohn Doe 1229/07/201607/08/201691898OK
151Dacres RoadJohn Doe 1331/07/201614/08/2016141891OK
161Dacres RoadJohn Doe 1402/08/201621/09/2016501853Overdue
171Dacres RoadJohn Doe 1505/08/201619/08/2016141886OK
181Dacres RoadJohn Doe 1606/08/201614/08/201681891OK
Assignment
Cell Formulas
RangeFormula
G3:G18G3=IF(ISBLANK(F3),TODAY()-E3,F3-E3)
H3:H18H3=IF(ISBLANK(F3),"ALLOCATED",TODAY()-F3)
I3:I18I3=IF(G3>30,"Overdue","OK")
B3:B18B3=INDEX(Territory!$A$2:$C$37,MATCH(Assignment!A3,Territory!$A$2:$A$37,0),2)
Cells with Data Validation
CellAllowCriteria
E3:F18Datebetween 01/01/2016 and 31/12/2022
A3:A18Whole numberbetween 1 and 35


So the spreadsheet below will contain new rows of date and all the columns in this spreadsheet needs to be compared with the master sheet above. Columns that need to be compared is Territory, Publisher , Assigned, Returned. which have the same names as in the master spreadsheet above.

the sheet below has a row 22 the is not present in the master so would need to be added the master spreadsheet. Please note that new row could appear anywhere in the sheet and not necessarily at the bottom/

Perry Assignments_All data 18102021.xlsx
ABCDE
5TerritoryCampaignPublisherAssignedReturned
614John Doe 116/04/201616/05/2016
76John Doe 222/04/201618/05/2016
82John Doe 322/04/201608/07/2016
95John Doe 411/05/201627/06/2016
101John Doe 514/05/201625/06/2016
1111John Doe 620/05/201604/07/2016
127John Doe 701/06/201620/07/2016
1327John Doe 803/06/201601/07/2016
1432John Doe 903/06/201608/07/2016
1525John Doe 1008/06/201613/07/2016
1628John Doe 1111/06/201616/08/2016
1715John Doe 1229/07/201607/08/2016
186John Doe 1331/07/201614/08/2016
1911John Doe 1402/08/201621/09/2016
201John Doe 1505/08/201619/08/2016
212John Doe 1606/08/201614/08/2016
2214John Doe 2406/08/201622/08/2016
Sheet1


Any advice and starter code would be greatly appreciated.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,215,039
Messages
6,122,802
Members
449,095
Latest member
m_smith_solihull

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