problem with Application.ScreenUpdating
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.
--
Regards,
Tom Ogilvy
"Betty" wrote in message
...
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.
-----Original Message-----
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
-----Original Message-----
For most people it works. Your experience is not
typical. Perhaps if you
posted your code someone might be able to spot the cause.
--
Regards,
Tom Ogilvy
"Betty" wrote in
message
.. .
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,
.
.
|