ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   accelerate in loop (https://www.excelbanter.com/excel-programming/287323-accelerate-loop.html)

Mark[_17_]

accelerate in loop
 
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

Bob Phillips[_6_]

accelerate in 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)

"Mark" wrote in message
...
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[_17_]

accelerate in loop
 
Its work effect!
Thx Bob for this and another tips.
Sincerely
Mark

-----Original Message-----
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)

"Mark" wrote in message
...
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



.



All times are GMT +1. The time now is 09:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com