View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default delete entire row with condition

Hi Anna

Is the column sorted. The below macro will work even if ColA is sorted or
not...Try and feedback

Sub DeleteRows()
Dim lngRow As Long
For lngRow = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If WorksheetFunction.CountIf(Columns(1), Range("A" & lngRow)) _
1 Then Rows(lngRow).Delete

Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Anna" wrote:

I would like to have a macro that scan a column (i.e. column a). Under the
scanned column, the entired row of any duplicate cell will be deleted. (i.e.
cell a5=abc, cell a6, a7=abc, row a6 and a7 will be deleted). Anyone can give
me a big hand?
Thank you so much.