View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
RadarEye RadarEye is offline
external usenet poster
 
Posts: 78
Default Delete row/s with the same elements as the above row

Hi Arno

Try this, created with Excel 2003:

Sub RemoveRepeatedRow()
Dim blnRemove As Boolean
Dim intCols As Integer
Dim intCol As Integer

ActiveSheet.UsedRange.Cells(2, 1).Select
intCols = ActiveSheet.UsedRange.Columns.Count - 1
Do
blnRemove = True
For intCol = 0 To intCols
If ActiveCell.Offset(0, intCol).Value < ActiveCell.Offset
(-1, intCol).Value Then
blnRemove = False
Exit For
End If
Next
If blnRemove Then
ActiveCell.EntireRow.Delete
Else
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell)

End Sub


HTH,

Wouter