Slow VBA macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Every time the following code runs and it reaches a blank cell it takes 2-3
seconds to update the cell with a zero:

Do Until ActiveCell.Offset(1, -3) = ""

ActiveCell.Offset(1, 0).Range("A1").Select

Select Case ActiveCell
Case Is = ""
Selection.FormulaR1C1 = 0
End Select

Loop

I've tried Application.ScreenUpdating = False but the macro is still very
slow.

Any suggestions as to how I might speed this up?
 
TRy this

Application.Calculation = xlCalculationManual
i = 0
With Activecell
Do Until .Offset(i+1, -3) = ""
Select Case.Offset(i+1, 0).Range("A1")
Case Is = ""
.Value = 0
End Select
i = i+1
Loop
Application.Calculation = xlCalculationAutomatic

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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