delete duplicate row

somenoob

Board Regular
Joined
Sep 19, 2011
Messages
100
Hi everyone, i need to delete duplicate rows but i dont know how to code it.

I have to check through the rows starting in range B13 to F13 to all the rows below it. if there is an exact same text in the cells then i will have to delete it.

How do i code it? Thanks
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Try this out, adjust the column reference
Sub DeleteDups()
'This code will look in column G and delete the entire row
'For any duplicates it finds
Dim x As Long, LastRow As Long
LastRow = Range("g65536").End(xlUp).Row
For x = LastRow To 1 Step -1
If Application.WorksheetFunction.CountIf(Range("g1:g" & x), Range("g" & x).Text) > 1 Then
Range("g" & x).EntireRow.Delete
End If
Next x

End Sub
 
Upvote 0
Try this

Code:
ActiveSheet.Range("$B$13:$F$10000").RemoveDuplicates Columns:=Array(1, 2, 3, 4, 5),  Header:=xlYes
 
Upvote 0
Thanks for the replies

Try this out, adjust the column reference

i see that the codes check for one column. How do i change it to check for B to F starting in row 13.

ActiveSheet.Range("$B$13:$F$10000").RemoveDuplicates Columns:=Array(1, 2, 3, 4, 5), Header:=xlYes

i tried this code too but it return me this error when i run it.
object doesn't support this property or method
 
Upvote 0
This solution is working for Office 2010.

Thanks for the replies



i see that the codes check for one column. How do i change it to check for B to F starting in row 13.



i tried this code too but it return me this error when i run it.
object doesn't support this property or method
 
Upvote 0
This solution is working for Office 2010.

Thanks for the replies



i see that the codes check for one column. How do i change it to check for B to F starting in row 13.



i tried this code too but it return me this error when i run it.
object doesn't support this property or method
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,722
Members
452,939
Latest member
WCrawford

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