Set Print Area using multiple named ranges that vary dynamically

excelguru88

New Member
Joined
Feb 1, 2018
Messages
4
Hey guys -

I need to be able to set print area using named ranges that vary dynamically.

For example, I have 4 named ranges and they are:

Range1
Range2
Range3
Range4


Now in one scenario, I want the PrintArea to be set to = Range1,Range3
In another scenario, I want the PrintArea to be set to = Range2,Range3
...and so on

Now, I can manually update the print area to the two scenarios above, but how can I do that using a formula or VBA?

Any thoughts would be helpful.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi

You don't say how you choose which scenario and so I'll assume that you write the number of the scenario in A1. For A1=1 you print scenario1, etc.

I would define names for the 2 scenarios, for ex. Scenario1=Sheet1!Range1,Sheet1!Range2 and then use for the Print_Area

=CHOOSE(Sheet1!$A$1,Sheet1!Scenario1,Sheet1!Scenario2)

but you can also use directly your named ranges, like

=CHOOSE(Sheet1!$A$1,(Sheet1!Range1,Sheet1!Range2),(Sheet1!Range3,Sheet1!Range4))
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,822
Members
449,190
Latest member
rscraig11

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