accelerate in loop

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

I'v script do some work.
I'd like accelerate its.
I want go to place "do while" (with counter i+1) if VBA
perform any/one condition without complete remainder block
of if.
Any suggestions would be much appreciated
Regards
Mark

Below example:

do while ...........

if cells(i,...... then
.....
end if

if cells(i,...... then
.....
end if

if cells(i,...... then
.....
end if

i=i+1
loop
 
Mark,

Is this what you want?

do while ...........

if cells(i,...... then
.....

elseif cells(i,...... then
.....

elseif cells(i,...... then
.....
end if

i=i+1
loop


You could also do a couple of other things to speed it up.

1. If there is a lot of changes to the active window, you could turn off
screen updating at the start
Application.ScreenUpdating = False
Set it back to True at the end.

2. If here are a lot of formulae, if any celss get amended, automatic
calculation might be kicking in all of the time. SO turn it off
Application.Calculation = xlCalculationManual
and set it back to automatic at the en d
Application.Calculation = xlCalculationAutomatic

--

HTH

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