View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
David Lloyd David Lloyd is offline
external usenet poster
 
Posts: 1
Default Clearing Contents

Sean:

You could use a loop to move through the worksheet. Within the loop,
compare the values in column A and column B using the ActiveCell.Offset
property. If A& B are the same, then you can set the values of the second
row to "". I tested the code below and it appears to work.

For example:

Sub TestMacro()
Dim wks As Worksheet
Dim colA As String
Dim colB As String
Dim i As Integer

Set wks = ActiveSheet

Cells(1, 1).Select

For i = 1 To wks.Cells.CurrentRegion.Rows.Count
colA = ActiveCell.Value
colB = ActiveCell.Offset(0, 1).Value

Do Until colA < ActiveCell.Offset(1, 0).Value And colB <
ActiveCell.Offset(1, 1).Value
ActiveCell.Offset(1, 0) = ""
ActiveCell.Offset(1, 1) = ""
ActiveCell.Offset(1, 0).Select
i = i + 1
Loop
ActiveCell.Offset(1, 0).Select
Next i


--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


"Sean" wrote in message
...
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