jim may
Well-known Member
- Joined
- Jul 4, 2004
- Messages
- 7,486
When I try and Step through this code I get a Single Step Dialog Box with several buttons on it, yet Excel IS FROZEN UP on me -- I must go to the
Task Manager and Close ALL my Excel Files...
What is Happening?
Task Manager and Close ALL my Excel Files...
What is Happening?
Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
'If the Master Sheet is Printed
Application.EnableEvents = False
If ActiveSheet.Name = "Master" Then
SLr = ActiveSheet.Range("G" & Rows.Count).End(xlUp).Row
ActiveSheet.PageSetup.PrintArea = "$A$5:$H$" & SLr & ""
With ActiveSheet.PageSetup
.Zoom = False
.FitToPagesWide = 1
'.FitToPagesTall = 0
.RightFooter = Now
End With
ElseIf ActiveSheet.Name = "Initial-Import" Then
SLr = ActiveSheet.Range("B" & Rows.Count).End(xlUp).Row
ActiveSheet.PageSetup.PrintArea = "$A$5:$U$" & SLr & ""
With ActiveSheet.PageSetup
.Zoom = False
.FitToPagesWide = 1
'.FitToPagesTall = 2
.RightFooter = Now
End With
ElseIf ActiveSheet.Name = "FinalReport" Then
If Not MasterDirty Then
SLr = ActiveSheet.Range("G" & Rows.Count).End(xlUp).Row
ActiveSheet.PageSetup.PrintArea = "$A$5:$O$" & SLr & ""
With ActiveSheet.PageSetup
.Zoom = False
.FitToPagesWide = 1
'.FitToPagesTall = 2
.RightFooter = Now
End With
Else
MsgBox "There have been Changes to the Master Sheet" & vbNewLine & _
"Which have Not been transferred to your Final" & vbNewLine & _
"Report. Return to the Master Sheet and Click" & vbNewLine & _
"the Update Button BEFORE Proceeding."
Cancel = True
End If
End If
Application.EnableEvents = True
End Sub