Speed of Macro on 2 PC

M

misskh

Hi,

Can someone please help. We have 2 PCs.

When a macro is run on PC 1, no issue, and I run this almost everyday.

Then I open up the same file and run the same macro on PC 2, the macro
is really really slow.

When I go back to PC 1 and try to run the same file I have the same
issue as PC 2.

What I usually do to resolve the issue is recreate the file from
scratch, put in the macro.
If I run this on PC1, again I have no issue. And I can run it as may
times as I want with no issue.

Again, if I open up the file and run it on PC2, same problem.
 
D

Dave Peterson

If your code is hiding/showing/deleting/inserting rows or columns, then maybe...

(Saved from a previous post)

Do you see the dotted lines that you get after you do a print or print preview?

If you do
Tools|Options|view tab|uncheck display page breaks

does the run time go back to normal?

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 (Your code goes here)

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

End Sub

Being in View|PageBreak Preview mode can slow macros down, too.
 

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