Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Im my macro that I have, Im reusing some code I was referred to. The code is below. Code ------------------- Range(Range("M2"), ActiveCell.SpecialCells(xlLastCell)).Select Dim Col As Integer Dim N As Long Dim V As Variant Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Col = ActiveCell.Column If Selection.Rows.Count 1 Then Set Rng = Selection Else Set Rng = ActiveSheet.UsedRange.Rows End If N = 0 For R = Rng.Rows.Count To 1 Step -1 V = Rng.Cells(R, 1).Value If Application.WorksheetFunction.CountIf(Rng.Columns( 1), V) 1 Then Rng.Rows(R).EntireRow.Delete N = N + 1 End If Next R ------------------- However, what I need to do is delete ALL lines that match when duplicate is found, not just the duplicates. Example, if I have 3 rows that match, I need to delete all 3. If I onl have 1 row and it is unique, dont do anything. What my example does is find 3 duplicates and deletes 2 of them an leaves 1 of the duplicate rows! Not good enough!!! Any help is appreciated -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting duplicate rows | Excel Discussion (Misc queries) | |||
deleting duplicate rows | Excel Discussion (Misc queries) | |||
I need help with deleting duplicate, and the original cell, row. | Excel Discussion (Misc queries) | |||
Deleting Duplicate Rows | Excel Discussion (Misc queries) | |||
Deleting Duplicate Rows | Excel Programming |