Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default Set print range for individual sheets (ranged) in workbook.

I tried running several codes to group sheets and then self set the
print area but couldn't get around the first sheet having the dominant
/ default print area for all of the following sheets.

So, I have the following code (below).

I need it precede it with a code that says:
Locate worksheet named "sheet x" in this workbook.
Run this code for each individual sheet after "sheet x".



Sub Auto_prnt_setup()

Dim lLastRow As Long
lLastRow = Range("e65536:g65536").End(xlUp).Row
ActiveSheet.PageSetup.PrintArea = Range("a1:j" & lLastRow).Address
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.PageSetup.PrintArea = ""

End Sub


Any ideas?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Set print range for individual sheets (ranged) in workbook.

How about just doing one worksheet at a time:

Sub Auto_prnt_setup()
dim wks as worksheet
Dim lLastRow As Long
for each wks in activeworkbook.worksheets
'or
'for each wks in activewindow.selectedsheets
with wks
'I usually use just a single column
lLastRow = .Range("e65536:g65536").End(xlUp).Row
.PageSetup.PrintArea = .Range("a1:j" & lLastRow).Address
end with
next wks
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

End Sub

"J.W. Aldridge" wrote:

I tried running several codes to group sheets and then self set the
print area but couldn't get around the first sheet having the dominant
/ default print area for all of the following sheets.

So, I have the following code (below).

I need it precede it with a code that says:
Locate worksheet named "sheet x" in this workbook.
Run this code for each individual sheet after "sheet x".

Sub Auto_prnt_setup()

Dim lLastRow As Long
lLastRow = Range("e65536:g65536").End(xlUp).Row
ActiveSheet.PageSetup.PrintArea = Range("a1:j" & lLastRow).Address
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.PageSetup.PrintArea = ""

End Sub

Any ideas?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default Set print range for individual sheets (ranged) in workbook.


.....worked GREAT !!!!

THANx

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA Amaxwell Excel Worksheet Functions 4 August 17th 06 06:23 AM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Programming 6 March 29th 06 12:43 PM
Need Help w/ Print Macro to Print All Visible Sheets (including Charts) in a Workbook will Excel Programming 3 September 23rd 04 08:05 PM
Saving workbook sheets to individual excel files keepitcool Excel Programming 0 August 9th 03 01:05 AM


All times are GMT +1. The time now is 07:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"