View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
moondark[_10_] moondark[_10_] is offline
external usenet poster
 
Posts: 1
Default Insert calculation with VBA is slow


Hey there,

Of course, looping down is the easiest way, so why shouldn't you go
it.

so while the stopcondition is false do
Insert the formulae or values into the cells I&J of the current
column
increment the rowindex
loop

That was the slow way, to make excel calculate much faster, we're now
going to deactivate calculation and screenupdating, while inserting.

The Code will look like:

Code:
--------------------
rowindex=1
application.screenupdating=false
application.calculation = xlManual
On Error goto Resetting
while ([stop_condition])
Cells(rowindex,9)="I"
Cells(rowindex,10)="J"
rowindex = rowindex + 1
loop

Resetting:
Application.screenupdating = true
Application.calculation= xlAutomatic

--------------------



Regards,

Simon


--
moondark
------------------------------------------------------------------------
moondark's Profile: http://www.excelforum.com/member.php...o&userid=27390
View this thread: http://www.excelforum.com/showthread...hreadid=475759