View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
John Smith John Smith is offline
external usenet poster
 
Posts: 62
Default Can this be done? If bn=b(n+1) and cn=c(n+1) then delete row(n+1)

Ken Hudson wrote:
Hi John,
Give this a try...

Option Explicit
Dim ILoop As Integer
Dim NumRows As Integer
Sub DelDupes()
Application.ScreenUpdating = False
NumRows = Range("B65536").End(xlUp).Row
For ILoop = NumRows To 2 Step -1
If Cells(ILoop, "B") = Cells(ILoop - 1, "B") And Cells(ILoop, "C") =
Cells(ILoop - 1, "C") Then
Rows(ILoop).Delete
End If
Next ILoop
Application.ScreenUpdating = True
End Sub

Press Alt-F11 to open the VB editor.
Go to Insert Module, paste in this code and then run it.


Thanks. I followed your instruction to run the program and got an
error message saying "compiler error: syntax error" and an arrow
pointed to "Sub DelDupes()". I can't image what is wrong with that
statement.