ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set PrintArea Not Working (https://www.excelbanter.com/excel-programming/386349-set-printarea-not-working.html)

bw

Set PrintArea Not Working
 
What are the problems here?

The first gets an error on execution: "Unable to set the PrintArea
property of the PageSetup class"
1). ActiveSheet.PageSetup.PrintArea = Range(Cells(LastRow - 24, 1),
Cells(LastRow + 1, 12))

The second just doesn't work (doesn't set the PrintArea to the range in
question).
2. Range(Cells(LastRow - 24, 1), Cells(LastRow + 1, 12)).Select
ActiveSheet.PageSetup.PrintArea =
ActiveCell.CurrentRegion.Address

Can someone provide an answer to both questions?




JMay

Set PrintArea Not Working
 
the Printarea property requires a "String" data type,
the address property returns a string..

example:
ActiveSheet.PageSetup.PrintArea = Range(Cells(3, 2), Cells(8,
4)).Address



"bw" wrote in message
:

What are the problems here?

The first gets an error on execution: "Unable to set the PrintArea
property of the PageSetup class"
1). ActiveSheet.PageSetup.PrintArea = Range(Cells(LastRow - 24, 1),
Cells(LastRow + 1, 12))

The second just doesn't work (doesn't set the PrintArea to the range in
question).
2. Range(Cells(LastRow - 24, 1), Cells(LastRow + 1, 12)).Select
ActiveSheet.PageSetup.PrintArea =
ActiveCell.CurrentRegion.Address

Can someone provide an answer to both questions?



bw

Set PrintArea Not Working
 
Thank you sir!
That fixed the problem.
Bernie



"JMay" wrote in message
...
the Printarea property requires a "String" data type,
the address property returns a string..

example:
ActiveSheet.PageSetup.PrintArea = Range(Cells(3, 2), Cells(8,
4)).Address



"bw" wrote in message
:

What are the problems here?

The first gets an error on execution: "Unable to set the PrintArea
property of the PageSetup class"
1). ActiveSheet.PageSetup.PrintArea = Range(Cells(LastRow - 24,
1),
Cells(LastRow + 1, 12))

The second just doesn't work (doesn't set the PrintArea to the range
in
question).
2. Range(Cells(LastRow - 24, 1), Cells(LastRow + 1, 12)).Select
ActiveSheet.PageSetup.PrintArea =
ActiveCell.CurrentRegion.Address

Can someone provide an answer to both questions?





All times are GMT +1. The time now is 09:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com