View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default Clearing Contents

Sorry .. typo .. should be

For i = ilastrow To 2 Step -1


"Toppers" wrote:

Sean,
Try this:

Sub RemoveAB()
Dim ilastrow As Long, i As Long
ilastrow = Cells(Rows.Count, "A").End(xlUp).Row
For i = ilastrow To 1 Step -1
If Cells(i - 1, "A") = Cells(i, "A") And _
Cells(i - 1, "B") = Cells(i, "B") Then
Cells(i, "A") = ""
Cells(i, "B") = ""
End If
Next i
End Sub


HTH

"Sean" wrote:

I have a workbook open with about 22,000 rows in it. It has data like this

A B C D

SD FRED 3 9
SD FRED 4 2
SD FRED 6 27
SF SAM 3 6
SF SAM 4 8
SF SAM 6 1

Now A and B continually shows the same info and C and D are what changes, I
want to clear the contents on columns A and B if it sees the same in A and B
twice, before jumping to the next row. So the data would look like this when
through

A B C D

SD FRED 3 9
4 2
6 27
SF SAM 3 6
4 8
6 1

Same data but it only shows me the vendor and the name once and then
continues on with the rest of the data. Any ideas anyone!!! Thanks in
advance

Sincerely

Sean