Vba to highlight the cell and remove duplicates

ashupuneet

New Member
Joined
Nov 8, 2016
Messages
9
HI
I need a help in preparing a macro which identify the duplicate in column C of sheet1 followed by removing old row and retain new row but before deletion of old row i wish to highlight the cell in color red of new row (which is retained after duplicate remove) where values has changed between duplicate old row and new row.
if possible also that changed value insert as comment in new row cell in same column.

Now i am using this macro to identify the duplicate and remove old entries
Sub Delete_Dups_Keep_Last()
Dim i As Long
Dim j As Long
Worksheets("Sheet1").Activate
Dim ROW_DELETED As Boolean
i = 2 'start on second row
Application.ScreenUpdating = False
Do While i <= Sheets("Sheet1").UsedRange.Rows.Count
ROW_DELETED = False
For j = i + 1 To ActiveSheet.UsedRange.Rows.Count
If Cells(i, 3) = Cells(j, 3) Then
Rows(i).Delete
ROW_DELETED = True
Exit For
End If
Next j
If Not ROW_DELETED Then i = i + 1
Loop
Application.ScreenUpdating = True
End Sub

In sheet 1 row 3 and row 9 having duplicate value in column C and wish to highlight and insert changed value as a comment in row 9.




Confirmed delivery dateSTPMOLong DescriptionProd. Line ProdArea CropOrder TypeSupplierFinish date (DMY)Kg'sPackages / TH'sTH's
11337972WMW XXX OKCCP XP1 2/7/2017262.761 2628.661
11337975WMW XXX OKCCPXP12/7/2017285.722843.77
11337976WMW XXX OKCCPXP12/7/2017260.3812615.787
11337978WMW XXX OKCCPXP12/9/2017277.3522855.618
11337980WMW XXX OKCCPXP12/9/2017240.6672439.644
11337981WMW XXX OKCCPXP12/9/2017280.3453005.02
11337982WMW XXX OKCCPXP12/10/2017276.2252894.56
11337975WMW XXX OKCCPXP12/10/2017247.9262861.062
<colgroup><col width="57" style="width: 43pt; mso-width-source: userset; mso-width-alt: 1824;"> <col width="23" style="width: 17pt; mso-width-source: userset; mso-width-alt: 736;"> <col width="63" style="width: 47pt; mso-width-source: userset; mso-width-alt: 2016;"> <col width="203" style="width: 152pt; mso-width-source: userset; mso-width-alt: 6496;"> <col width="40" style="width: 30pt; mso-width-source: userset; mso-width-alt: 1280;"> <col width="48" style="width: 36pt; mso-width-source: userset; mso-width-alt: 1536;"> <col width="40" style="width: 30pt; mso-width-source: userset; mso-width-alt: 1280;" span="2"> <col width="23" style="width: 17pt; mso-width-source: userset; mso-width-alt: 736;"> <col width="71" style="width: 53pt; mso-width-source: userset; mso-width-alt: 2272;"> <col width="63" style="width: 47pt; mso-width-source: userset; mso-width-alt: 2016;"> <col width="40" style="width: 30pt; mso-width-source: userset; mso-width-alt: 1280;"> <col width="71" style="width: 53pt; mso-width-source: userset; mso-width-alt: 2272;"> <tbody> </tbody>


Thanks in Advance
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hi
I am not a regular visitor to this forum & was not aware with this " cross post", can any one have solution for my query?

Thanks
 
Upvote 0

Forum statistics

Threads
1,215,248
Messages
6,123,866
Members
449,129
Latest member
krishnamadison

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