How to wirte a code in VBA (Excel 2000) to delete the repeating rows by comparing 2 columns??

Ae_Barbara

New Member
Joined
Dec 17, 2009
Messages
1
Hello !!

Currently, I 've a project concerning about Macro. I find it difficulties to write a script in Microsoft Excel 2000. So can anyone help me how to write a script in macro in order to delete a repeating
rows by comparing two columns?? But I still want to keep the first row in repeating data.. cos I feel like messy to see repeating so many time. Thats the reason why I want to keep one.

Here is an example...

Eqt Comment Date
A1 Hi 1-Dec-09
B1 Hi 2-Dec-09
B1 Hi 2-Dec-09
B1 Hi 2-Dec-09
E1 Hi 4-Dec-09
E2 Hi 5-Dec-09
C1 Hi 6-Dec-09
C1 Hi 6-Dec-09
D1 Hi 7-Dec-09
E6 Hi 12-Dec-09
F3 Hi 14-Dec-09
F3 Hi 14-Dec-09
F3 Hi 14-Dec-09
F3 Hi 14-Dec-09
G2 Hi 15-Dec-09

Note: I want to compare 'Eqt' & 'Date' columns only.. if the two columns is repeating, I just want to delete the repeating but keep one.. The main thing is I don't care the other columns. & after deleting the the repeating rows, the subsequent data must shift up.

Here is the outcome..

Eqt Comment Date
A1 Hi 1-Dec-09
B1 Hi 2-Dec-09
E1 Hi 4-Dec-09
E2 Hi 5-Dec-09
C1 Hi 6-Dec-09
D1 Hi 7-Dec-09
E6 Hi 12-Dec-09
F3 Hi 14-Dec-09
G2 Hi 15-Dec-09

PS. I hope you can solve my problem. Thanks & Regards:)
Ae
 

Some videos you may like

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Hello and welcome to MrExcel.

Try this with a copy of your sheet

Code:
Sub DelDups()
Dim LR As Long, i As Long, j As Integer
LR = Cells(Rows.Count, "A").End(xlUp).Row
For i = LR To 3 Step -1
    With Range("A" & i)
        If .Value = .Offset(-1).Value And .Offset(, 2).Value = .Offset(-1, 2).Value Then Rows(i).Delete
    End With
Next i
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,122,224
Messages
5,594,916
Members
413,952
Latest member
JGer

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
Top