VBA for finding duplicated rows of data with changes

Abgar

Active Member
Joined
Jun 20, 2009
Messages
265
Hi all,

Hoping someone can help with a quick VBA code (or point me in the right direction).

I have a data worksheet, which contains many rows of data, spreading across multiple columns. Each day, a new extract of data is added to the spreadsheet (added as new rows at the bottom), and there will be duplicated data.
We have been using conditional formatting on Column A (a unique ID number) to show the duplicates, and then we delete the duplicates.
When adding the new data, sometimes the Column A will be the same, but there will be a different value in Column H (based on changes in the system we extract the data from).

I'm hoping to essentially have a VBA code that will run through each row and check if ALL data for the row in columns A-H is the same. If it is all the same, highlight the duplicated row of data in Fill Colour RED
If Column A is the same, but there is any difference in data from Column B-H, then highlight the row in Fill Colour Green.
And if Column A is unique (not duplicated), then don't highlight that row at all.

Per the below example, the top 8 rows are the original data, then the new data is added below. Rows 11, 13 and 15 are highlighted green, becuase the ID in column A is a duplicate, but some of the other data is different.
Rows 12 and 14 are highlighted red becuase Column A is a duplicate, but all the other data is the same.
Columns 16-18 are not highlighted, becuase Column A is a new unique value, and is not duplicated.

Book1
ABCDEFGH
1Unique IDSurnameFirst nameClientStateCategoryContactDate
2302383SlaterTomBills BoatsTasmaniaLockyer17/03/2021
3297842SmithPeterBills BoatsQueenslandLockyer17/03/2021
4302097TemplePaulToms TomatosNew South WalesBiggestLockyer17/03/2021
5302272RoughMarkBetteys BeerTasmaniaTrident17/03/2021
6299573GroutJohnBills BoatsTasmaniaBaddestTrident17/03/2021
7302900WilsonLukeToms TomatosQueenslandGoodall17/03/2021
8301106SmithMatthewBills BoatsNew South WalesPeters17/03/2021
9302163BleekerSallyBetteys BeerTasmaniaSmith17/03/2021
10
11302383SlaterTomBills BoatsTasmaniaLockyer18/03/2021
12297842SmithPeterBills BoatsQueenslandLockyer17/03/2021
13302097TemplePaulToms TomatosNew South WalesBiggestSmith17/03/2021
14302272RoughMarkBetteys BeerTasmaniaTrident17/03/2021
15299573GroutJohnToms TomatosTasmaniaBaddestTrident17/03/2021
16123456WilsonLukeToms TomatosQueenslandGoodall17/03/2021
17654321SmithMatthewBills BoatsNew South WalesPeters17/03/2021
18987645BleekerSallyBetteys BeerTasmaniaSmith17/03/2021
Sheet1



Thanks in advance for any info you can share.

Cheers,
ABGar
 
dear Zot,
i just found your post, and it's exactly what i need, but instead highlight the duplicate row with red color, i prefer to add note "Duplicate"in column I, and can you help me to modified your code? thank you.

best regards,
bigMe
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

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