Speed up Code?

  • Thread starter Thread starter Sige
  • Start date Start date
S

Sige

Hi All,

In order to clean up some downloaded figures I run the following sub.
It works fine!!!

Sometimes I have the impression though that routine is calculating
rather slow.
It gets through but ...it takes
(sometimes looots of..)time.

Is there a way to speed up the routine???

Public Sub BlanksToNumbers()
Dim r As Range
Dim w As Worksheet
On Error GoTo err
Application.ScreenUpdating = False
For Each w In ActiveWorkbook.Worksheets
For Each r In w.UsedRange.Cells
r.Cells.Font.Name = "Arial"
If r.TEXT = "" And r.Formula = "" Then r.Value = ""
Next r
Next w
Application.ScreenUpdating = True
err:
End Sub

Cheeers Sige
 
you can try this at the beginning
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False

and this at the end

With Application
CalcMode = .Calculation
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
 
I think (hope) that you mean

you can try this at the beginning
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False

and this at the end

With Application
.Calculation = CalcMode
.ScreenUpdating = True
 
Hi Bob, Gary many thanks!

Gary: I'll take Bob's solution ;o)

"NOSPAM" to be removed for direct mailing...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top