Set Print Area Grouped Worksheets

Poiuytresa

New Member
Joined
Aug 21, 2008
Messages
5
Ive a file with multiple worksheet and trying to set print area for all worksheets at once (grouped). This macro posted by Juan Pablo works fine with one sheet but when I group the worksheets this macro doesnt work. I would like to set print area when the worksheets are grouped so I can run the macro only once.


Sub SetArea()
ActiveSheet.PageSetup.PrintArea = Range("A1",Range("M65536").End(xlUp)).Address
End Sub

Thanks
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

gauntletxg

Well-known Member
Joined
Jul 15, 2008
Messages
636
You'll need to use a loop

Code:
Dim ws As Worksheet
For Each ws In Worksheets
ws.PageSetup.PrintArea = Range("A1",Range("M65536").End(xlUp)).Address
Next ws
 

Poiuytresa

New Member
Joined
Aug 21, 2008
Messages
5
Thank you
But still setting print area only in the first worksheet

Sub SetArea()
Dim ws As Worksheet
For Each ws In Worksheets
ws.PageSetup.PrintArea = Range("A1", Range("e65536").End(xlUp)).Address
Next ws
End Sub

Am I doing anything wrong?
Thanks
 

Poiuytresa

New Member
Joined
Aug 21, 2008
Messages
5
Hi
Thank you
But still setting print area only in the first worksheet

Sub SetArea()
Dim ws As Worksheet
For Each ws In Worksheets
ws.PageSetup.PrintArea = Range("A1", Range("e65536").End(xlUp)).Address
Next ws
End Sub

Am I doing anything wrong?
Thanks
 

Watch MrExcel Video

Forum statistics

Threads
1,102,343
Messages
5,486,289
Members
407,538
Latest member
kbendelac

This Week's Hot Topics

Top