PDA

View Full Version : printing issue



rodney_malod
03-27-2007, 04:16 AM
How can i make the code print out 2 sheets everytime, and then the one of 4 sheets that has a number in F4?


Sub Macro1()
'
' Macro1 Macro
' Macro recorded 13/02/2007 by Rodders
'
With ActiveWorkbook
For Each Worksheet In .Worksheets
If "F2" > 0 Then

Worksheet.Activate
Worksheet.Visible = xlSheetVisible
With ActiveSheet.PageSetup
.PaperSize = xlPaperA4
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.LeftFooter = ""

End With
Next Worksheet
End With
'
ActiveWorkbook.PrintOut Copies:=1, Collate:=True
'
End Sub

lucas
03-27-2007, 10:05 AM
Try this Rodney:
Sub Macro1()
Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
If Not WS.Range("F2") = 0 Then
' WS.PrintPreview 'for testing only
WS.PrintOut Copies:=2, Collate:=True
End If
Next WS
End Sub

mdmackillop
03-27-2007, 10:27 AM
Hi Rodney
When you post code, please select it and click the VBA button to format it as shown.
This will also highlight coding errors where the indenting is not balanced, showing that you are missing an End If statement in Post #1
Regards
MD