VBA Print area wont let me do more than 20 areas?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,
I'm a bit stuck and could really do with someone that can think a little outside the box to help me on this one,
Firstly let me explain what i'm doing

When I create a multi page PDF from a sheet a defint the Print area so that we can have dieffent number of sheets

so what I end up with is a list of pages and ranges to print like this
Page 6 Z411:AM469 Z411:AM469
Page 7 Z471:AM529 Z471:AM529
Page 8 Z530:AM588 Z530:AM588
Page 9 Z590:AM648 Z590:AM648
Page 10 Z650:AM708 Z650:AM708
Page 11 Z710:AM768 Z710:AM768
Page 12 Z770:AM828 Z770:AM828
Page 13 Z830:AM888 Z830:AM888
Page 14 Z890:AM948 Z890:AM948
Page 15 Z950:AM1008 Z950:AM1008
Page 16 Z1010:AM1068 Z1010:AM1068
Page 17 Z1070:AM1128 Z1070:AM1128
Page 18 Z1130:AM1188 Z1130:AM1188
Page 19 Z1190:AM1248 Z1190:AM1248
Page 20 Z1250:AM1308 Z1250:AM1308
Page 21 Z1310:AM1368 Z1310:AM1368
Page 22 Z1370:AM1428 Z1370:AM1428
Page 23 Z1430:AM1488 Z1430:AM1488
Page 24 Z1490:AM1608 Z1490:AM1608

I then join them together like this
=TEXTJOIN(",",TRUE,L47:L69)

Then I use this VBA to set the print areas
VBA Code:
Sub Page_setup()
ActiveSheet.PageSetup.PrintArea = ActiveSheet.Range("I43")
End Sub

Now this works fine as ling as we have less than 20 ranges but when it goes above 20 it bugs out and wont do it as 20 is the max
anyone know of a good practile way to get around this?
all Pages are 60 rows long,
But I want to be able to choose which page we do and dont print so i cant just set it as one big range and add in breaks.

so to cut a long store short I would love a macro that could set more than 20 page ranges?

please help if you can
thanks
Tony
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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