Simple Macro that prints to pdf using a drop down menu

controlz

New Member
Joined
Jul 15, 2016
Messages
10
Hi,
I wanted a simple macro that selects an item from a drop down menu in cell b3 (causing the summary sheet to change), prints the summary range, pdfs the sheet, and then saves it named as a certain cell (g3).
Thank you so much! I'm really struggling!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
here is the code to create the pdf.

Code:
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
        Filename:="C:\mypath\"& Range("G3") & ".pdf", _
        Quality:=xlQualityStandard, _
        IncludeDocProperties:=False, _
        IgnorePrintAreas:=False, _
        OpenAfterPublish:=False
 
Upvote 0
The drop down list is in cell b3 and the source is listed from b20:b149. Thank you! Thank you! Thank you!
 
Upvote 0
so you want 129 pdf files created??

untested.

Code:
for r = 20 to 149
Range("B3") = cells(r,"B")
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
        Filename:="C:\mypath\"& Range("G3") & ".pdf", _
        Quality:=xlQualityStandard, _
        IncludeDocProperties:=False, _
        IgnorePrintAreas:=False, _
        OpenAfterPublish:=False

next r
 
Upvote 0

Forum statistics

Threads
1,215,444
Messages
6,124,891
Members
449,194
Latest member
JayEggleton

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