Thread: Macro or VBA
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
GAIL HORVATH GAIL HORVATH is offline
external usenet poster
 
Posts: 5
Default Macro or VBA

Yers this does what I want it to. Thank you very much

--
Gail M Horvath


Eastern Time Zone
"Greg Wilson" wrote in message
...
Try this. Please advise if it works or not.

Regards,
Greg

Sub DeleteDuplicates()
Dim i As Long, x As Long, rw As Long
Dim rng As Range

Set rng = Selection
rw = Selection.Row + Selection.Count - 1
i = 2: x = 0
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
Do Until x = rw
If Cells(i, 1).Value = Cells(i - 1, 1).Value Then
Cells(i, 1).EntireRow.Delete
Else
i = i + 1
End If
x = x + 1
Loop
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub

"GAIL HORVATH" wrote:

I hane a column in a spread sheet whose values at times are repeats of
the cell above. I want that row deleted if the value is the same as the
cell above is there a way to do it programaticallY?

e.g.
A B C D E
Acct # MedRec# field field field
112233 xxx xxx xxx xxx
112233 xxx xxx xxx xxx
123123 xxx xxx xxx xxx
123412 xxx xxx xxx xxx
123412 xxx xxx xxx xxx

I would want the rows in bold red deleted

--
Gail M Horvath

x