PC Review


Reply
Thread Tools Rate Thread

Can somebody help me with a slow macro problem.

 
 
JeffMelton
Guest
Posts: n/a
 
      13th Oct 2006
I have a macro that has suddenly slowed down to a crawl. I turned
screen updating off to watch it, and simple loops can be followed @
about 2 per second or so. I've tried it on several different computers
and the same thing happens. All calculations are done in the macro, so
calculating cells isn't a problem. This thing has slowed down from
maybe 20 secs or less to ten minutes. I really can't figure out whats
going on as all my other sheets do just like normal. Also, if I add a
test macro with a simple loop through cells it works fine as well. The
workbook isn't large. The code is in a form, could that be the issue?
Something else I've ust noticed is if I run the macro, and leave the
workbook open, and then run a different macro in a different worksheet,
it slows way down also.

I'm completely stumped.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      13th Oct 2006
Just to definitely rule out the usual culprets try adding the following lines
of code to see what difference they make... If they do not make any
difference then post your code so we can take a quick look see...

With Application
.Calculation = xlCalculationManual
.EnableEvents = False
'your code here
.Calculation = xlCalculationAutomatic
.EnableEvents = True
End With
--
HTH...

Jim Thomlinson


"JeffMelton" wrote:

> I have a macro that has suddenly slowed down to a crawl. I turned
> screen updating off to watch it, and simple loops can be followed @
> about 2 per second or so. I've tried it on several different computers
> and the same thing happens. All calculations are done in the macro, so
> calculating cells isn't a problem. This thing has slowed down from
> maybe 20 secs or less to ten minutes. I really can't figure out whats
> going on as all my other sheets do just like normal. Also, if I add a
> test macro with a simple loop through cells it works fine as well. The
> workbook isn't large. The code is in a form, could that be the issue?
> Something else I've ust noticed is if I run the macro, and leave the
> workbook open, and then run a different macro in a different worksheet,
> it slows way down also.
>
> I'm completely stumped.
>
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      13th Oct 2006
If you insert/delete rows or columns and have done a print (or print preview),
then excel could be trying to determine where to put those dotted lines (showing
pagebreaks) for each insertion/deletion.

If you're in view|page break preview mode, you can have the same trouble.

You may want to do something like:

Option Explicit
Sub testme()

Dim CalcMode As Long
Dim ViewMode As Long

Application.ScreenUpdating = False

CalcMode = Application.Calculation
Application.Calculation = xlCalculationManual

ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

ActiveSheet.DisplayPageBreaks = False

'do the work

'put things back to what they were
Application.Calculation = CalcMode
ActiveWindow.View = ViewMode

End Sub



JeffMelton wrote:
>
> I have a macro that has suddenly slowed down to a crawl. I turned
> screen updating off to watch it, and simple loops can be followed @
> about 2 per second or so. I've tried it on several different computers
> and the same thing happens. All calculations are done in the macro, so
> calculating cells isn't a problem. This thing has slowed down from
> maybe 20 secs or less to ten minutes. I really can't figure out whats
> going on as all my other sheets do just like normal. Also, if I add a
> test macro with a simple loop through cells it works fine as well. The
> workbook isn't large. The code is in a form, could that be the issue?
> Something else I've ust noticed is if I run the macro, and leave the
> workbook open, and then run a different macro in a different worksheet,
> it slows way down also.
>
> I'm completely stumped.


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Slow Macro - Formatting Macro ScottMsp Microsoft Excel Programming 1 24th Mar 2009 08:23 PM
Laptop is very slow, any tool to fix this slow problem? GS Windows XP Basics 7 12th Jul 2007 10:41 PM
Slow Macro =?Utf-8?B?RnJhbmsgU2l0dW1vcmFuZw==?= Microsoft Excel Programming 7 30th Jun 2007 02:26 PM
Macro help, very slow =?Utf-8?B?U2NvdHQgTWFyY3Vz?= Microsoft Excel Programming 0 8th Nov 2006 05:39 PM
Very Slow Macro Problem Dean Microsoft Excel Programming 3 24th Mar 2006 04:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:19 PM.