VBA for print to pdf multiple sheets with different print ranges and save prompt

sinkrswim

New Member
Joined
Mar 29, 2016
Messages
5
I have to start by admitting that it's been a long time since I even attempted VBA and despite a few hours of trying different methods/blocks this week, I am still not getting the result I want, so I'm hoping someone can lend a hand.

I have a workbook shared by my team and I need them to be able to quickly print to pdf two of the 4 sheets (let's say they're called "Cost" and "Pricing").

"Cost" is a pre-formatted sheet with formulas lookup values from another sheet when data is entered into the first 4 visible columns, so there are about a page's worth of "blank" rows to allow them to enter the items they need to lookup.

"Pricing" is similar but uses some of the data looked up on Cost to calculate other things.

I want to set the print area to only the rows that have data on "Cost" and fit all columns to 1 page wide by 1 page tall. Mainly to avoid printing an unknown number of empty rows.
At the same time, I want to set the print area for "Pricing" to fit on 1x1 (not restricted by rows).
The filename should be based on the values in C2 - D2 - E2 on "Cost".
And the user should be prompted to select where to save the file.

Thanks in advance for any help!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,214,979
Messages
6,122,552
Members
449,088
Latest member
davidcom

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