Dynamic print area

niall91

New Member
Joined
Jul 21, 2020
Messages
45
Office Version
  1. 2019
Platform
  1. Windows
Hi Guys

Having trouble setting a dynamic print area
trying to make this work
but keep coming up with a type mismatch error

VBA Code:
Sheets("sheets1").pagesetup.PrintArea = .Range(Cells(1,x),Cells(9, y))
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
oops :oops:
remove .Address

Bad
.Cells(14, setUpPage + 9)).Address

Good
.Cells(14, setUpPage + 9))
 
Upvote 0
Away from PC at the moment
Will look later and update thread then
 
Upvote 0
Hey

i got it to work (y)

VBA Code:
Cells(1, pagesetup).Resize(14, pagesetup + 9).Copy
Cells(1, pagesetup + 10).Select
ActiveSheet.Paste
 
Upvote 0

Forum statistics

Threads
1,215,053
Messages
6,122,888
Members
449,097
Latest member
dbomb1414

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