Create a PDF but only of the pages i choose

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,201
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,
I have a sheet called "Data" that I want to export as a PDF
however i want to be able to choose which pages i include?

there are 21 pages in total and the page set up is already done,
so what i was thinking is if i have a list of the pages in column AA range AA10:AA31
and in AB10:AB31 answer "Yes" or "No" if yes then include this sheet?

is it possible to do this?
if so please help.

thanks

Tony
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
untested:
VBA Code:
Sub Macro1()

For r = 10 To 31

If Cells(r, "AB") = "Yes" Then

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "C:\Users\Free\Desktop\Book" & r-9 & ".pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, From:=r - 9, to:=r - 9, _
        OpenAfterPublish:=False
       
End If
Next r
End Sub

hth,

Ross
 
Upvote 0

Forum statistics

Threads
1,215,776
Messages
6,126,830
Members
449,343
Latest member
DEWS2031

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top