View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Macroman Macroman is offline
external usenet poster
 
Posts: 8
Default Snailspace Macro Needs Rejuvenation....Anyone?

What I normally do to speed up my macros is to turn off autocalculation. You
can do this via Tools and Option , if you record a macro while doing it you
get the code , while still recording a macro turn it back on and paste the
code before and after your own VBA code.

Macroman


"aircraft_model VBA" wrote in message
...
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!