problem with Application.ScreenUpdating

  • Thread starter Thread starter Betty
  • Start date Start date
B

Betty

Hi,

Is the purpose of Application.ScreenUpdating = False in an
Excel macro supposed to "hide" changes to the workbook
from the users? The worksheet that is being created by my
macro displays and runs the commands so users can see even
though I have Application.ScreenUpdating = False.

I don't want anything to display.

I am using Windows XP and MS Excel 2003. I have installed
MS SP3 also.

Why doesn't the Application.ScreenUpdating = False work?


Thank you,
 
For most people it works. Your experience is not typical. Perhaps if you
posted your code someone might be able to spot the cause.
 
Betty,

I'm not exactly sure what you mean.

Application.ScreenUpdating = False stops the display from
changing while your macro is operating. This makes things
run quicker and prevents the user from seeing a whole lot
of annoying flickering stuff! However, once your macro has
run, the changes that were made (values altered, workbooks
created and so forth) will all be visible to the user
unless you have closed or hidden them.

Pete
 
Application.ScreenUpdating = False is not working.

Thank you for your help.

Here is the code. Sorry it's a little long and messy.

Sub Print_Stuff()
' doesn't seem to work...
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Sheets("Print_Template").Visible = True
Application.Goto Reference:="template"
Selection.Copy
Set NewSheet = Worksheets.Add
NewSheet.Name = "Print_All"
' For each entry in the list add a section to Print_All
For Each c In Worksheets("OD_list").Range("loops").Cells
If Abs(c.Value) > 0 Then
i = c.Value
Worksheets("Print_All").Activate
If i = 1 Then
linkCell = "A1"
Else
linkCell = "A" & ((i - 1) * 87)
End If
Range(linkCell).Select
ActiveSheet.Paste
ActiveCell.FormulaR1C1 = i
Else
If c.Value = "" Then
Exit For
End If
End If
Next

' In each section added, hide two rows of lookup values
For Each c In Worksheets("OD_list").Range("loops").Cells
If Abs(c.Value) > 0 Then
i = c.Value
If i = 1 Then
cRow = 5
linkCell = "A5"
Else
cRow = (((i - 1) * 87) + 4)
linkCell = "A" & (((i - 1) * 87) + 4)
End If
Range(linkCell).Select
Selection.EntireRow.Hidden = True
linkCell = "A" & (cRow + 1)
Range(linkCell).Select
Selection.EntireRow.Hidden = True
' Set page break
If cRow > 87 Then
Worksheets("Print_All").Rows(cRow -
4).PageBreak = xlPageBreakManual
End If
Else
If c.Value = "" Then
Exit For
End If
End If
Next
' Format for printing
cRow = cRow + 81
linkCell = "S" & cRow
Application.Calculation = xlCalculationAutomatic
Worksheets("Print_All").Activate
ActiveSheet.PageSetup.PrintArea = "$A$1:" & linkCell
ActiveSheet.PageSetup.Zoom = 50
Worksheets("Print_All").Columns("T").PageBreak =
xlPageBreakManual
Worksheets("Print_All").DisplayPageBreaks = True
Worksheets("Print_All").PrintPreview
'ActiveWindow.SelectedSheets.PrintOut Copies:=1,
Collate:=True

NewSheet.Delete
Sheets("Print_Template").Visible = False
Application.ScreenUpdating = True
End Sub
 
It worked fine for me. The only thing I saw was the printpreview screen and
a prompt about deleting sheets.

If you want to suppress the prompt about deleting sheets

Application.DisplayAlerts = False
NewSheet.Delete
Application.DisplayAlerts = True
 
I found the reason why it is not working.

Application.ScreenUpdating = False should work. However,
if you use Select or Selection then ScreenUpdating is set
back to True. I repeated Application.ScreenUpdating =
False after each occurrence.

And it does what I expect.
 
I am sure littering your code with ScreenUpdating settings solves the
problem, but for everyone else, using Select or Selection does not alter the
ScreenUpdating setting. In fact, the main use of ScreenUpdating is to mask
such behavior.

And as I said, you code ran fine for me as written. Perhaps you have some
event code firing that is resetting the Screenupdating.
 
Sorry to bump an old thread, but I'm having a similar problem.

On 2 machines, one desktop, one laptop, both running Excel 2000 unde
Windows XP, both running same code.

One machine (desktop) the screenupdating is always TRUE, so the macr
takes forever to run and the screen flashes/flip constantly. On th
laptop however screenupdating works as expected.

Is there maybe an option setting in Excel that could be preventing th
screenupdating from working the same between two machines?

Or a setting in Windows that could be conflicting with it
 
Has this been tried?

Application.ScreenUpdating = False
Application.DisplayAlerts = False

at the beginning of eacg piece of code to execute.

HTH. Jim
 

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

Back
Top