Hi,
Anyone suggest a macro to identify where there is a unique entry in column A and then delete the whole row?
many thanks
Jon
Hi,
Anyone suggest a macro to identify where there is a unique entry in column A and then delete the whole row?
many thanks
Jon
Try this
Option Explicit Sub Macro1() Dim rFilter As Range, rVisible As Range Dim iRow As Long, iArea As Long Set rFilter = ActiveSheet.Range("A1") Set rFilter = Range(rFilter, rFilter.End(xlDown)) rFilter.AdvancedFilter Action:=xlFilterInPlace, Unique:=True Set rVisible = ActiveSheet.Columns(1).SpecialCells(xlCellTypeVisible) Set rVisible = Intersect(rVisible, ActiveSheet.UsedRange) ActiveSheet.ShowAllData For iArea = rVisible.Areas.Count To 1 Step -1 For iRow = rVisible.Areas(iArea).Rows.Count To 1 Step -1 If Application.WorksheetFunction.CountIf(rFilter, rVisible.Areas(iArea).Cells(iRow, 1).Value) = 1 Then If rVisible.Areas(iArea).Cells(iRow, 1).Row <> 1 Then rVisible.Areas(iArea).Cells(iRow, 1).EntireRow.Delete End If End If Next iRow Next iArea End Sub
---------------------------------------------------------------------------------------------------------------------
Paul
Remember: Tell us WHAT you want to do, not HOW you think you want to do it
1. Use [CODE] ....[/CODE ] Tags for readability
[CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
2. Upload an example
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
3. Mark the thread as [Solved] when you have an answer
Thread Tools (on the top right corner, above the first message)
4. Read the Forum FAQ, especially the part about cross-posting in other forums
http://www.vbaexpress.com/forum/faq...._new_faq_item3
Cheers Paul
Works perfectly
regards
Jon