Excel2003 Macro runs slow???

I

Infinity

I am using Excel2001 but my colleague is using Excel2003 (her computer
is much faster then mine). When running a macro to hide certain rows in
one thousand rows it runs slow. Let me explain further.

I have one thousand rows. In each cells in this rows will give me a
value of either "x" or "0". This value is an if statement which depends
or 2 other cells in the same row. If the value of this "0" then my macro
would hide these rows.

Running this macro on Excel 2001 is very very fast but when running on
Excel 2003 it is SLOW. I have found out why, is it because Excel 2003
is recalculating each cell when the macro is running :eek: . When i
turn the Automatic Calculate to Manual it runs as per normal :( . Why
is this and how do I overcome this problem without having to change the
Automatic Calculation to manual?:confused:

Thanks in advance.
 
N

Nigel

You do not need to turn off calculation manually - this code will turn it on
and off, so wrap your code in this

Application.Calculation = xlManual
' your code
Application.Calculation = xlAutomatic

You might find that turning off screen updating might improve things e.g.

Application.ScreenUpdating = False
' your code
Application.ScreenUpdating = True

One other option would be to use Autofilters that hides rows given specific
conditions, thereby avoiding any code at all?
 

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

Top