Thread: Slow Code
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Amedee Van Gasse[_3_] Amedee Van Gasse[_3_] is offline
external usenet poster
 
Posts: 102
Default Slow Code

Frank Kabel wrote:

Hi
1. Spot: probably not much you can do as the file has to be opened.
this is not your code which is slow but the opening process. Faster
hardware / harddisk may help :-)


You could use ADO to get data from a file, that avoids opening it.
See this page: http://www.rondebruin.nl/ado.htm

2. Spot: I don't see anything that could slow down the code. But maybe
you have skipped a loop in your posting :-)


I don't know either.

3. Spot. only some genral ideas:
- disable application.screenupdating
- disable automatic calculation
while the code runs


Start every macro with:

With Application
.Calculation = xlManual
.ScreenUpdating = False
.DisplayAlerts = False
End With

and end with:

With Application
.Calculation = xlAutomatic
.ScreenUpdating = True
.DisplayAlerts = True
End With

--
To top-post is human, to bottom-post and snip is sublime.