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


The below piece of VB prints out a print area on my worksheet OK where
the print area varies in length.

Sub Button4_Click()
cc = 26
For r = 26 To 150
If Sheets("Moves Request Form").Range("AF" & r) = "CC Reference Number
:-" Then cc = r
Next r
Sheet1.PageSetup.PrintArea = "B3:CP" & cc 'Sets the Print area
ActiveSheet.PrintOut 'Prints the Print area
Sheet1.PageSetup.PrintArea = "" 'Clears the Print area
End Sub

There is always a piece of data in the middle somewhere that I dont
need to appear on the printout.
Is there any way I can include two different print areas in the above
VB?


--
grahammal
------------------------------------------------------------------------
grahammal's Profile: http://www.excelforum.com/member.php...o&userid=20336
View this thread: http://www.excelforum.com/showthread...hreadid=517229

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Multiple print areas

Could you hide what you don't need printed??

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Multiple print areas


Unfortunately I can't hide the unwanted printout area as this contains
options that users need to be able to select different user forms.
Their personnal details appear at the top which I need. The next part
is the options that are not required on the printout. Underneath the
options is the user forms that I do need. Hence two different print
areas.


--
grahammal
------------------------------------------------------------------------
grahammal's Profile: http://www.excelforum.com/member.php...o&userid=20336
View this thread: http://www.excelforum.com/showthread...hreadid=517229

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Multiple print areas


Hi,

Youmaybe able to hide the unwanted rows in the middle for the print ou
& then immediately reshowing them using an adapted version of

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "One To Hide Rows On" Then
Rows("27:35").Hidden = True
Else
End If
End Sub

(entered in the "thisworkbook" code sheet) & then to unhide the
immediately after the printout replace the line
"ActiveSheet.PrintOut 'Prints the Print area"
in your code with
"ActiveSheet.PrintOut 'Prints the Print area
Rows("27:35").Hidden = False"
to return the layout to normal for use again.

Another option is to create a new sheet, set print area (I've left thi
for you), print from there & then delete the temp sheet using cod
similar to below:

Sheets.Add.Name = "Temp Printing Sheet"
Worksheets("Original Sheet").Range("A8:I19,A22:I33").Copy _
Worksheets("Temp Printing Sheet").Range("a1")
'set the print area on temp sheet
Worksheets("Temp Printing Sheet").PageSetup.PrintArea = "?"
Worksheets("Temp Printing Sheet").PrintOut 'Prints the Print area
Application.DisplayAlerts = False
Worksheets("Temp Printing Sheet").Delete
Application.DisplayAlerts = True

NB: The 2 ranges on the second line & the can be changed as needed.

One issue I can think of with the temp sheet method is upsetting a
headers/footers you may have set up on the printed sheet.

Hth
Rob Brockett
NZ
Always learning & the best way to learn is to experience...

grahammal Wrote:
Unfortunately I can't hide the unwanted printout area as this contain
options that users need to be able to select different user forms
Their personnal details appear at the top which I need. The next par
is the options that are not required on the printout. Underneath th
options is the user forms that I do need. Hence two different prin
areas


--
broro18
-----------------------------------------------------------------------
broro183's Profile: http://www.excelforum.com/member.php...fo&userid=3006
View this thread: http://www.excelforum.com/showthread.php?threadid=51722

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Multiple print areas

Hi grahammal

Look here for examples
http://www.rondebruin.nl/print.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl


"grahammal" wrote in message
...

The below piece of VB prints out a print area on my worksheet OK where
the print area varies in length.

Sub Button4_Click()
cc = 26
For r = 26 To 150
If Sheets("Moves Request Form").Range("AF" & r) = "CC Reference Number
:-" Then cc = r
Next r
Sheet1.PageSetup.PrintArea = "B3:CP" & cc 'Sets the Print area
ActiveSheet.PrintOut 'Prints the Print area
Sheet1.PageSetup.PrintArea = "" 'Clears the Print area
End Sub

There is always a piece of data in the middle somewhere that I dont
need to appear on the printout.
Is there any way I can include two different print areas in the above
VB?


--
grahammal
------------------------------------------------------------------------
grahammal's Profile: http://www.excelforum.com/member.php...o&userid=20336
View this thread: http://www.excelforum.com/showthread...hreadid=517229



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
how do I print multiple print areas on one page Leo18 Excel Discussion (Misc queries) 1 January 11th 10 07:28 PM
Can I adjust print scaling for multiple print areas on the same sh N. Sammons Excel Discussion (Misc queries) 0 June 18th 08 10:24 PM
printing multiple print areas with a print dialog box LHaro Excel Programming 0 August 17th 05 09:56 PM
Set Multiple Print Areas James Hamilton Excel Discussion (Misc queries) 1 June 22nd 05 06:03 AM
Multiple print areas, one worksheet -need to print to PDF! mohagany19 Excel Programming 0 October 6th 04 11:54 PM


All times are GMT +1. The time now is 03:01 PM.

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"