i see, you are right, but onething, this is specific for one sheet...If your Print Button In Page work Correctly, You can its macro to Quick access toolbar.
Select down arrow at the end of quick access toolbar. Then Select More Command.
Change Popular commands to Macro and then Select your Macro name for Print.
This isUpload your print button code here to see. I forgot it.
Sub PageTestForPrint()
Dim MyRange As Range
Dim ws As Worksheet
Dim Lastrow As Long
Dim i As Long
Dim n As Long
Dim PrintArea As String
Application.ScreenUpdating = False
Set ws = ActiveSheet
Sheets("Sheet2").Visible = True
Sheets("Sheet2").Select
For i = 1 To 30840
If Cells(34 * i + 8, 1).Value <> "" Then
n = i + 1
Else
GoTo Printing
End If
Next i
Printing:
Debug.Print n
Sheets("sheet2").PrintOut
Sheets("Sheet2").Visible = False
Sheets("Sheet1").Select
Application.ScreenUpdating = True
End Sub
Sheet1->Sheet3Are your code for sheet3 & sheet4 different than this?
Sub PageTestForPrint()
Dim MyRange As Range
Dim ws As Worksheet
Dim Lastrow As Long
Dim i As Long
Dim n As Long
Dim j As Long
Dim PrintArea As String
Application.ScreenUpdating = False
Set ws = ActiveSheet
j = ActiveSheet.Index
Debug.Print j
Sheets(j + 1).Visible = True
Sheets(j + 1).Select
For i = 1 To 30840
If Cells(34 * i + 8, 1).Value <> "" Then
n = i + 1
Else
GoTo Printing
End If
Next i
Printing:
Debug.Print n
Sheets(j + 1).PrintOut
Sheets(j + 1).Visible = False
Sheets(j).Select
Application.ScreenUpdating = True
End Sub
Very Smart?, can give a name for sheet that print from? For example Sheet2 is printsheet Sheet1 named Print1 and Sheet 4 printsheet Sheet3 named Print2 that i can named sheets order, Sheet1,2,3... main sheet and Print1,2,3... printsheet from Sheet number orderTest this. Print One sheet after Activesheet Always.
VBA Code:Sub PageTestForPrint() Dim MyRange As Range Dim ws As Worksheet Dim Lastrow As Long Dim i As Long Dim n As Long Dim j As Long Dim PrintArea As String Application.ScreenUpdating = False Set ws = ActiveSheet j = ActiveSheet.Index Debug.Print j Sheets(j + 1).Visible = True Sheets(j + 1).Select For i = 1 To 30840 If Cells(34 * i + 8, 1).Value <> "" Then n = i + 1 Else GoTo Printing End If Next i Printing: Debug.Print n Sheets(j + 1).PrintOut Sheets(j + 1).Visible = False Sheets(j).Select Application.ScreenUpdating = True End Sub
Sub PageTestForPrint()
Dim MyRange As Range
Dim ws As Worksheet
Dim Lastrow As Long
Dim i As Long
Dim n As Long
Dim j As Long
Dim PrintArea As String
Application.ScreenUpdating = False
Set ws = ActiveSheet
j = ActiveSheet.Index
Sheets(j + 1).Visible = True
Sheets(j + 1).Select
Debug.Print ws.Range("A1").Value
For i = 1 To 30840
If Cells(34 * i + 8, 1).Value <> "" Then
n = i + 1
Else
GoTo Printing
End If
Next i
Printing:
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="Print" & (j + 1) / 2 _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
Sheets(j + 1).Visible = False
Sheets(j).Select
Application.ScreenUpdating = True
End Sub