Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macros and screen updates

I've written a macro that updates several sheets and
graphs. Execution is very slow because of the constant
refreshing of the display.

Is there a way to turn off the screen updates until the
macros have finished?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default macros and screen updates

Tim Laud wrote:
I've written a macro that updates several sheets and
graphs. Execution is very slow because of the constant
refreshing of the display.

Is there a way to turn off the screen updates until the
macros have finished?


Application.ScreenUpdating = False

Calculations can also slow down your macros. You might want to add
Application.Calculation = xlCalculationManual to the start of your macro
and Application.Calculation = xlCalculationAutomatic to the end.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default macros and screen updates


-----Original Message-----
I've written a macro that updates several sheets and
graphs. Execution is very slow because of the constant
refreshing of the display.

Is there a way to turn off the screen updates until the
macros have finished?
.

At the beginning of your macro add in
Application.ScreenUpdating = False
Make sure that at the end of your macro that you set
Application.ScreenUpdating = True

HTH
David
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default macros and screen updates

Tim

Early on in code use these lines

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual


At end of code these

Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True


Gord Dibben Excel MVP - XL97 SR2 & XL2002


On Fri, 1 Aug 2003 08:42:12 -0700, "Tim Laud" wrote:

I've written a macro that updates several sheets and
graphs. Execution is very slow because of the constant
refreshing of the display.

Is there a way to turn off the screen updates until the
macros have finished?




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default macros and screen updates

Hello Tim,

There certainly is a way to control screen updating within a VBA macro. The
following is from the VBA help file, with a query on "ScreenUpdating."

ScreenUpdating Property
See Also Applies To Example Specifics
True if screen updating is turned on. Read/write Boolean.

Remarks
Turn screen updating off to speed up your macro code. You won't be able to
see what the macro is doing, but it will run faster.

Remember to set the ScreenUpdating property back to True when your macro
ends.

Example
This example demonstrates how turning off screen updating can make your
code run faster. The example hides every other column on Sheet1, while
keeping track of the time it takes to do so. The first time the example
hides the columns, screen updating is turned on; the second time, screen
updating is turned off. When you run this example, you can compare the
respective running times, which are displayed in the message box.

Dim elapsedTime(2)
Application.ScreenUpdating = True
For i = 1 To 2
If i = 2 Then Application.ScreenUpdating = False
startTime = Time
Worksheets("Sheet1").Activate
For Each c In ActiveSheet.Columns
If c.Column Mod 2 = 0 Then
c.Hidden = True
End If
Next c
stopTime = Time
elapsedTime(i) = (stopTime - startTime) * 24 * 60 * 60
Next i
Application.ScreenUpdating = True
MsgBox "Elapsed time, screen updating on: " & elapsedTime(1) & _
" sec." & Chr(13) & _
"Elapsed time, screen updating off: " & elapsedTime(2) & _
" sec."

--------------------
From: "Tim Laud"
Subject: macros and screen updates
Date: Fri, 1 Aug 2003 08:42:12 -0700
I've written a macro that updates several sheets and
graphs. Execution is very slow because of the constant
refreshing of the display.

Is there a way to turn off the screen updates until the
macros have finished?


Regards,
Chris Jensen[MSFT]

This posting is provided “AS IS” with no warranties, and confers no rights.

“Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026?* If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
http://www.microsoft.com/security/se...s/ms03-026.asp and/or to
visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the SCAN program from the Windows Update site will help to
insure you are current with all security patches, not just MS03-026.”

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
screen tip with macros Bonobo Excel Discussion (Misc queries) 3 March 4th 08 12:03 PM
Screen flash while running macros Jay Excel Discussion (Misc queries) 2 December 3rd 07 09:25 PM
CAE macro for green screen updates with Excel data Sriram Excel Discussion (Misc queries) 1 July 16th 06 04:19 PM
print box opens in right screen of dual screen setup why gerrys Excel Discussion (Misc queries) 1 June 30th 06 06:47 PM
Need to convert point on screen to various screen resolutions Donna YaWanna Excel Discussion (Misc queries) 5 October 26th 05 10:10 PM


All times are GMT +1. The time now is 01:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"