View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
aircraft_model VBA aircraft_model VBA is offline
external usenet poster
 
Posts: 5
Default Snailspace Macro Needs Rejuvenation....Anyone?

Presented below is a macro called cleandata that runs at snailspace!!.

I would like 2 changes to this slow macro:

1. Change the reference of the worksheet from the name (in this case =
new) to simply active worksheet, so that it is not name specific.

2. Speed it up so that it works faster.


Sub Cleandata()
Dim r As Long
Application.ScreenUpdating = False
With Worksheets("new")
For r = .UsedRange.Rows.Count To 1 Step -1
If .Cells(r, "K").Value = "0" Then
.Rows(r).Delete
End If
Next
End With
For Each c In [E1:E35000]
Select Case c.Offset(0, 5).Text
Case Is = "CRJ", "EM2", "ER3", "ER4", "ERD", "ERJ"
c.Value = c.Value & IIf(Right(c.Text, 1) < "E", "E", "")
End Select
Next c
Application.ScreenUpdating = True
End Sub

If you have some suggested improvements not mentioned above, please feel
free to make them to the modified code.

As always, thanks in advance to the great excel speedsters!!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!