Results 1 to 3 of 3

Macro to Print Multiple (Selective) Excel sheets to One PDF

Threaded View

  1. #1
    Registered User
    Join Date
    02-20-2013
    Location
    Tennessee
    MS-Off Ver
    Excel 2010
    Posts
    1

    Macro to Print Multiple (Selective) Excel sheets to One PDF

    Hi all,

    I am new to code and trying to figure out how to print multiple pages to PDF. I have sifted through other posts and found how to make it work when you have specific set pages to print. My problem is that I am trying to only print certain pages according to the iinformation in a particular cell on each sheet. I have the code to actually print out the worksheets tied to a button on my cover page and everything works great. When i tried to convert the code over to print to PDF I have had nothing but problems. I have included what I have for printing below. Can anyone help me convert this to print to pdf?

    Sub Print_Click()
    Application.ScreenUpdating = False
    Sheets("Report Cover").Select
    If Range("j35").Value = "N/A" Then
            Range("Cover1").PrintOut
            Else
            Range("Cover").PrintOut
    End If
    Sheets("Engineering").Select
    If Not IsError(Range("R2").Value) Then
            Range("EngPurch").PrintOut
    End If
    Sheets("Purchasing").Select
    If Not IsError(Range("R2").Value) Then
            Range("Purch").PrintOut
    End If
    Sheets("Logistics").Select
    If Not IsError(Range("B5").Value) Then
            Range("Logistics").PrintOut
    End If
    Sheets("Quality").Select
    If Not IsError(Range("B5").Value) Then
            Range("Quality").PrintOut
    End If
    Sheets("P_CS").Select
    If Not IsError(Range("p16").Value) Then
            Range("P_CS").PrintOut
    End If
    Sheets("P_Source").Select
    If Not IsError(Range("p16").Value) Then
                Range("P_Source").PrintOut
    End If
    Sheets("P_Supply").Select
    If Not IsError(Range("p16").Value) Then
               Range("P_Supply").PrintOut
    End If
    Sheets("P_PM").Select
    If Not IsError(Range("p16").Value) Then
                Range("P_PM").PrintOut
    End If
    Sheets("L_ASN").Select
    If Not IsError(Range("p16").Value) Then
                Range("L_ASN").PrintOut
    End If
    Sheets("L_SR").Select
    If Not IsError(Range("p16").Value) Then
                Range("L_SR").PrintOut
    End If
    Sheets("L_pkg").Select
    If Not IsError(Range("p16").Value) Then
                Range("L_pkg").PrintOut
    End If
    Sheets("L_CMP").Select
    If Not IsError(Range("p16").Value) Then
                Range("L_Cmp").PrintOut
    End If
    Sheets("Q_SPR").Select
    If Not IsError(Range("p16").Value) Then
                Range("Q_SPR").PrintOut
    End If
    Sheets("Q_PMR").Select
    If Not IsError(Range("p16").Value) Then
                Range("Q_PMR").PrintOut
    End If
    Sheets("Q_PPM").Select
    If Not IsError(Range("p16").Value) Then
                Range("Q_PPM").PrintOut
    End If
    Sheets("Q_QR").Select
    If Not IsError(Range("p16").Value) Then
                Range("Q_QR").PrintOut
    End If
    Sheets("Service Parts").Select
    If Range("q2").Value <> "N/A" Then
            Range("ServiceParts").PrintOut
            End If
    Sheets("Report Cover").Select
    Range("A1").Select
    Application.ScreenUpdating = True
    End Sub
    Last edited by JBeaucaire; 02-20-2013 at 03:27 PM. Reason: Added code tags, as per forum rules. Don't forget!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1