View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
jeannie v jeannie v is offline
external usenet poster
 
Posts: 127
Default What is wrong with this Macro?

Hi Don:

Thank you for your solution to my problem....I have tried both yours and
Conan's resolutions and both give me what I want......

I appreciate your expertise...Thank you!
--
jeannie v


"Don Guillett" wrote:

Quit selecting for one thing and work from the bottom up when deleting rows.
End if not needed here. You are also probably looking in more rows than
necessary, or desirable. Try this, AS WRITTEN

mc="J"
For i = cells(rows.count,mc).end(xlup).row to 1 step-1
If Cells(i,mc) = "LOA" Or Cells(i,mc) = "Termed" Or _
Cells(i,mc) = "Duplicate" Then Rows(i).delete
Next i

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"jeannie v" wrote in message
...
Hi Experts:

I have used this macro before and it worked perfectly...however, now when
it
searches and deletes the rows that I want it to, it takes forever to go
through the document....It used to go through very fast and deleted the
rows,
but now it deletes one row at a time very slowly....I have about 10000
records for it to go through and delete the records that are in the macro
and
it takes a long time to complete...What might be wrong with this Macro?

Sub DeleteLOATermedDupRecords()
'
' DeleteLOATermedDupRecords Macro
' Macro recorded 2/17/2008 by Jeannie Vincovich
'
For i = 1 To 12000
If Cells(i, "J") = "LOA" Or Cells(i, "J") = "Termed" Or _
Cells(i, "J") = "Duplicate" Then
Rows(i & ":" & i).Select
Selection.Delete Shift:=xlUp
i = i - 1
End If
Next i

End Sub


Any help you can provide would be greatly appreciated.
--
jeannie v