Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Print Selection


Hello,

The same range needs to be printed for one or sometimes more sheets in a
workbook.
This *should* be easy, but can't seem to make it happen properly.

Can anyone please correct the following code apppropriatlely?
Thanx in advance.
- Mike


Sub PrintDetail()
Range("B7:Y40").Select
For Each Sh In ActiveWindow.SelectedSheets
Sh.PageSetup.PrintTitleRows = "$1:$6"
Sh.Selection.PrintOut Collate:=True
Next
Next
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 533
Default Print Selection

Sub PrintEm()
Dim WS As Worksheet
For Each WS In ActiveWindow.SelectedSheets
WS.Range("B7:Y40").PrintOut
Next
End Sub


--
Jim
"MikeF" wrote in message
...
|
| Hello,
|
| The same range needs to be printed for one or sometimes more sheets in a
| workbook.
| This *should* be easy, but can't seem to make it happen properly.
|
| Can anyone please correct the following code apppropriatlely?
| Thanx in advance.
| - Mike
|
|
| Sub PrintDetail()
| Range("B7:Y40").Select
| For Each Sh In ActiveWindow.SelectedSheets
| Sh.PageSetup.PrintTitleRows = "$1:$6"
| Sh.Selection.PrintOut Collate:=True
| Next
| Next
| End Sub
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Print Selection

Jim,

Thank you, this works.

Except [asking for the world here <g] --- It prints each sheet separately.
Example - when printing three sheets, the footer on each says Page 1 of 1,
as opposed to Page 1 of 3/etc.
Is there any way to fix that?

- Mike

"Jim Rech" wrote:

Sub PrintEm()
Dim WS As Worksheet
For Each WS In ActiveWindow.SelectedSheets
WS.Range("B7:Y40").PrintOut
Next
End Sub


--
Jim
"MikeF" wrote in message
...
|
| Hello,
|
| The same range needs to be printed for one or sometimes more sheets in a
| workbook.
| This *should* be easy, but can't seem to make it happen properly.
|
| Can anyone please correct the following code apppropriatlely?
| Thanx in advance.
| - Mike
|
|
| Sub PrintDetail()
| Range("B7:Y40").Select
| For Each Sh In ActiveWindow.SelectedSheets
| Sh.PageSetup.PrintTitleRows = "$1:$6"
| Sh.Selection.PrintOut Collate:=True
| Next
| Next
| End Sub
|



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 533
Default Print Selection

Good point. But the problem is - to print them as one job they have to have
"PrintArea" defined on all sheets. Easy to do with a macro but you have to
remember that it's set and will affect manual prints of these sheets. Of
course you can expand the macro to reset the print area.<g

Sub PrintEm()
Dim WS As Worksheet
For Each WS In ActiveWindow.SelectedSheets
WS.Range("B7:Y40").Name = WS.Name & "!PrintArea"
Next
ActiveWindow.SelectedSheets.PrintOut
End Sub


--
Jim
"MikeF" wrote in message
...
| Jim,
|
| Thank you, this works.
|
| Except [asking for the world here <g] --- It prints each sheet
separately.
| Example - when printing three sheets, the footer on each says Page 1 of 1,
| as opposed to Page 1 of 3/etc.
| Is there any way to fix that?
|
| - Mike
|
| "Jim Rech" wrote:
|
| Sub PrintEm()
| Dim WS As Worksheet
| For Each WS In ActiveWindow.SelectedSheets
| WS.Range("B7:Y40").PrintOut
| Next
| End Sub
|
|
| --
| Jim
| "MikeF" wrote in message
| ...
| |
| | Hello,
| |
| | The same range needs to be printed for one or sometimes more sheets in
a
| | workbook.
| | This *should* be easy, but can't seem to make it happen properly.
| |
| | Can anyone please correct the following code apppropriatlely?
| | Thanx in advance.
| | - Mike
| |
| |
| | Sub PrintDetail()
| | Range("B7:Y40").Select
| | For Each Sh In ActiveWindow.SelectedSheets
| | Sh.PageSetup.PrintTitleRows = "$1:$6"
| | Sh.Selection.PrintOut Collate:=True
| | Next
| | Next
| | End Sub
| |
|
|
|


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Print Selection


Jim,
Thanx, but it stalls.
Doesn't seem to like the "name" syntax is the best I can assess.
- Mike

"Jim Rech" wrote:

Good point. But the problem is - to print them as one job they have to have
"PrintArea" defined on all sheets. Easy to do with a macro but you have to
remember that it's set and will affect manual prints of these sheets. Of
course you can expand the macro to reset the print area.<g

Sub PrintEm()
Dim WS As Worksheet
For Each WS In ActiveWindow.SelectedSheets
WS.Range("B7:Y40").Name = WS.Name & "!PrintArea"
Next
ActiveWindow.SelectedSheets.PrintOut
End Sub


--
Jim
"MikeF" wrote in message
...
| Jim,
|
| Thank you, this works.
|
| Except [asking for the world here <g] --- It prints each sheet
separately.
| Example - when printing three sheets, the footer on each says Page 1 of 1,
| as opposed to Page 1 of 3/etc.
| Is there any way to fix that?
|
| - Mike
|
| "Jim Rech" wrote:
|
| Sub PrintEm()
| Dim WS As Worksheet
| For Each WS In ActiveWindow.SelectedSheets
| WS.Range("B7:Y40").PrintOut
| Next
| End Sub
|
|
| --
| Jim
| "MikeF" wrote in message
| ...
| |
| | Hello,
| |
| | The same range needs to be printed for one or sometimes more sheets in
a
| | workbook.
| | This *should* be easy, but can't seem to make it happen properly.
| |
| | Can anyone please correct the following code apppropriatlely?
| | Thanx in advance.
| | - Mike
| |
| |
| | Sub PrintDetail()
| | Range("B7:Y40").Select
| | For Each Sh In ActiveWindow.SelectedSheets
| | Sh.PageSetup.PrintTitleRows = "$1:$6"
| | Sh.Selection.PrintOut Collate:=True
| | Next
| | Next
| | End Sub
| |
|
|
|





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 533
Default Print Selection

Runs here. Check for a typo.

--
Jim
"MikeF" wrote in message
...
|
| Jim,
| Thanx, but it stalls.
| Doesn't seem to like the "name" syntax is the best I can assess.
| - Mike
|
| "Jim Rech" wrote:
|
| Good point. But the problem is - to print them as one job they have to
have
| "PrintArea" defined on all sheets. Easy to do with a macro but you have
to
| remember that it's set and will affect manual prints of these sheets.
Of
| course you can expand the macro to reset the print area.<g
|
| Sub PrintEm()
| Dim WS As Worksheet
| For Each WS In ActiveWindow.SelectedSheets
| WS.Range("B7:Y40").Name = WS.Name & "!PrintArea"
| Next
| ActiveWindow.SelectedSheets.PrintOut
| End Sub
|
|
| --
| Jim
| "MikeF" wrote in message
| ...
| | Jim,
| |
| | Thank you, this works.
| |
| | Except [asking for the world here <g] --- It prints each sheet
| separately.
| | Example - when printing three sheets, the footer on each says Page 1
of 1,
| | as opposed to Page 1 of 3/etc.
| | Is there any way to fix that?
| |
| | - Mike
| |
| | "Jim Rech" wrote:
| |
| | Sub PrintEm()
| | Dim WS As Worksheet
| | For Each WS In ActiveWindow.SelectedSheets
| | WS.Range("B7:Y40").PrintOut
| | Next
| | End Sub
| |
| |
| | --
| | Jim
| | "MikeF" wrote in message
| | ...
| | |
| | | Hello,
| | |
| | | The same range needs to be printed for one or sometimes more
sheets in
| a
| | | workbook.
| | | This *should* be easy, but can't seem to make it happen properly.
| | |
| | | Can anyone please correct the following code apppropriatlely?
| | | Thanx in advance.
| | | - Mike
| | |
| | |
| | | Sub PrintDetail()
| | | Range("B7:Y40").Select
| | | For Each Sh In ActiveWindow.SelectedSheets
| | | Sh.PageSetup.PrintTitleRows = "$1:$6"
| | | Sh.Selection.PrintOut Collate:=True
| | | Next
| | | Next
| | | End Sub
| | |
| |
| |
| |
|
|
|


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Print Selection

Sometimes, you have to surround the worksheet name with apostrophes.

I'd try:

WS.Range("B7:Y40").Name = "'" & WS.Name & "'" & "!PrintArea"
or combining the last two strings into one:
WS.Range("B7:Y40").Name = "'" & WS.Name & "'!PrintArea"


MikeF wrote:

Jim,
Thanx, but it stalls.
Doesn't seem to like the "name" syntax is the best I can assess.
- Mike

"Jim Rech" wrote:

Good point. But the problem is - to print them as one job they have to have
"PrintArea" defined on all sheets. Easy to do with a macro but you have to
remember that it's set and will affect manual prints of these sheets. Of
course you can expand the macro to reset the print area.<g

Sub PrintEm()
Dim WS As Worksheet
For Each WS In ActiveWindow.SelectedSheets
WS.Range("B7:Y40").Name = WS.Name & "!PrintArea"
Next
ActiveWindow.SelectedSheets.PrintOut
End Sub


--
Jim
"MikeF" wrote in message
...
| Jim,
|
| Thank you, this works.
|
| Except [asking for the world here <g] --- It prints each sheet
separately.
| Example - when printing three sheets, the footer on each says Page 1 of 1,
| as opposed to Page 1 of 3/etc.
| Is there any way to fix that?
|
| - Mike
|
| "Jim Rech" wrote:
|
| Sub PrintEm()
| Dim WS As Worksheet
| For Each WS In ActiveWindow.SelectedSheets
| WS.Range("B7:Y40").PrintOut
| Next
| End Sub
|
|
| --
| Jim
| "MikeF" wrote in message
| ...
| |
| | Hello,
| |
| | The same range needs to be printed for one or sometimes more sheets in
a
| | workbook.
| | This *should* be easy, but can't seem to make it happen properly.
| |
| | Can anyone please correct the following code apppropriatlely?
| | Thanx in advance.
| | - Mike
| |
| |
| | Sub PrintDetail()
| | Range("B7:Y40").Select
| | For Each Sh In ActiveWindow.SelectedSheets
| | Sh.PageSetup.PrintTitleRows = "$1:$6"
| | Sh.Selection.PrintOut Collate:=True
| | Next
| | Next
| | End Sub
| |
|
|
|




--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Print Selection

Try this...

Sub PrintDetail()
'Range("B7:Y40").Select
For Each Sh In ActiveWindow.SelectedSheets
Sh.PageSetup.PrintTitleRows = "$1:$6"
Sh.Range("B7:Y40").PrintOut Collate:=True
'Next
Next
End Sub

--
HTH...

Jim Thomlinson


"MikeF" wrote:


Hello,

The same range needs to be printed for one or sometimes more sheets in a
workbook.
This *should* be easy, but can't seem to make it happen properly.

Can anyone please correct the following code apppropriatlely?
Thanx in advance.
- Mike


Sub PrintDetail()
Range("B7:Y40").Select
For Each Sh In ActiveWindow.SelectedSheets
Sh.PageSetup.PrintTitleRows = "$1:$6"
Sh.Selection.PrintOut Collate:=True
Next
Next
End Sub

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Print Selection

Jim,

Thank you, this works.

Except [asking for the world here <g] --- It prints each sheet separately.
Example - when printing three sheets, the footer on each says Page 1 of 1,
as opposed to Page 1 of 3/etc.
Is there any way to fix that?

- Mike


"Jim Thomlinson" wrote:

Try this...

Sub PrintDetail()
'Range("B7:Y40").Select
For Each Sh In ActiveWindow.SelectedSheets
Sh.PageSetup.PrintTitleRows = "$1:$6"
Sh.Range("B7:Y40").PrintOut Collate:=True
'Next
Next
End Sub

--
HTH...

Jim Thomlinson


"MikeF" wrote:


Hello,

The same range needs to be printed for one or sometimes more sheets in a
workbook.
This *should* be easy, but can't seem to make it happen properly.

Can anyone please correct the following code apppropriatlely?
Thanx in advance.
- Mike


Sub PrintDetail()
Range("B7:Y40").Select
For Each Sh In ActiveWindow.SelectedSheets
Sh.PageSetup.PrintTitleRows = "$1:$6"
Sh.Selection.PrintOut Collate:=True
Next
Next
End Sub

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Print Selection

Jim,
Juggled a few things on my own, and as follows is the code that works for
what I need.
Thanx for all your assistance.
- Mike

Sub PrintDetail()
Dim WS As Worksheet
For Each WS In ActiveWindow.SelectedSheets
WS.PageSetup.PrintArea = ("B7:i22")
WS.PageSetup.PrintTitleRows = "$1:$6"
Next
ActiveWindow.SelectedSheets.PrintOut
End Sub


"Jim Thomlinson" wrote:

Try this...

Sub PrintDetail()
'Range("B7:Y40").Select
For Each Sh In ActiveWindow.SelectedSheets
Sh.PageSetup.PrintTitleRows = "$1:$6"
Sh.Range("B7:Y40").PrintOut Collate:=True
'Next
Next
End Sub

--
HTH...

Jim Thomlinson


"MikeF" wrote:


Hello,

The same range needs to be printed for one or sometimes more sheets in a
workbook.
This *should* be easy, but can't seem to make it happen properly.

Can anyone please correct the following code apppropriatlely?
Thanx in advance.
- Mike


Sub PrintDetail()
Range("B7:Y40").Select
For Each Sh In ActiveWindow.SelectedSheets
Sh.PageSetup.PrintTitleRows = "$1:$6"
Sh.Selection.PrintOut Collate:=True
Next
Next
End Sub



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
VBA - Print Selection tom Excel Discussion (Misc queries) 2 February 27th 07 01:51 PM
Macro to print selection [email protected] Excel Programming 7 January 31st 07 05:40 PM
"Print Selection" doesn't print beyond automatic page breaks Andre Excel Discussion (Misc queries) 3 October 30th 06 09:30 PM
How can I print frozen panes to appear above print selection in Ex Snr Franco Excel Discussion (Misc queries) 1 April 2nd 06 03:06 PM
Print selection in one page filo666 Excel Programming 2 November 3rd 05 11:45 PM


All times are GMT +1. The time now is 06:54 PM.

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

About Us

"It's about Microsoft Excel"