Hi
i want my code to print named pages but allow me to select a printer from the printer list if it isn't possible i want the code to save those worksheet as pdf in file, can someone help?
Sub PrintNamedWorksheets()
Dim ws As Worksheet
Dim printArea As String
sheetNames = "Title Page,Summary"
printArea = "A1:j42,B1:i141" 'Adjust to match the print area you want
For Each sheetName In Split(sheetNames, ",")
Set ws = ThisWorkbook.Worksheets(sheetName)
ws.PageSetup.printArea = printArea
' Only print worksheets with specific names
If ws.Name = "Title Page" Or ws.Name = "Summary" Then
' Set print settings to fit all columns on one page
With ws.PageSetup
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
End With
' Print the current worksheet
ws.PrintOut ActivePrinter:=True
End If
Next ws
End Sub
Bookmarks