Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Print two ranges on page

I have the following procedure below which runs through a variable number of worksheets
and prints the same range out of each sheet onto an A4 sheet. It is not the prettiest
thing in the world but it works. However the sheet could hold two of these ranges on one
A4 page which is ideally what I would like to do, ie print one range from a sheet at the
top of the page and the next below it and so on. I would value any help.

Graham

Sub printNVZFieldsonly()

Dim r As Integer
Application.ScreenUpdating = False
With Application
.Calculation = xlManual
.MaxChange = 0.001
End With
r = Sheets("Entries").Cells(Rows.Count, "A").End(xlUp).row

For Each c In Sheets("Entries").Range("A12:A" & r)

' check if sheet exists
If WksExists(c.Value) Then
Sheets(c.Value).Unprotect
With Sheets(c.Value).Range("D4:E4").Font
.ColorIndex = 2
End With
With Sheets(c.Value).PageSetup
.PrintArea = "$A$3:$F$33"
.Orientation = xlPortrait
.PaperSize = xlPaperA4
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
Sheets(c.Value).PrintOut Copies:=1, Preview:=False, Collate:=True
With Sheets(c.Value).Range("D4:E4").Font
.ColorIndex = xlAutomatic
End With
Sheets(c.Value).Protect
End With
Else
MsgBox "There are no Fields to print. Operation cancelled.", vbInformation, "Print
Cancelled"
Exit Sub
End If
Next
With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Print two ranges on page

Hi Graham,

I think that the only way this can be done is to copy both the ranges to one
temporary worksheet. If the ranges contain formulas then I suggest that you
copy the range and then past special values and then paste special formats.
Note you do not have to recopy to paste special formats just place the 2
paste lines one after the other.

--
Regards,

OssieMac


"Graham H" wrote:

I have the following procedure below which runs through a variable number of worksheets
and prints the same range out of each sheet onto an A4 sheet. It is not the prettiest
thing in the world but it works. However the sheet could hold two of these ranges on one
A4 page which is ideally what I would like to do, ie print one range from a sheet at the
top of the page and the next below it and so on. I would value any help.

Graham

Sub printNVZFieldsonly()

Dim r As Integer
Application.ScreenUpdating = False
With Application
.Calculation = xlManual
.MaxChange = 0.001
End With
r = Sheets("Entries").Cells(Rows.Count, "A").End(xlUp).row

For Each c In Sheets("Entries").Range("A12:A" & r)

' check if sheet exists
If WksExists(c.Value) Then
Sheets(c.Value).Unprotect
With Sheets(c.Value).Range("D4:E4").Font
.ColorIndex = 2
End With
With Sheets(c.Value).PageSetup
.PrintArea = "$A$3:$F$33"
.Orientation = xlPortrait
.PaperSize = xlPaperA4
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
Sheets(c.Value).PrintOut Copies:=1, Preview:=False, Collate:=True
With Sheets(c.Value).Range("D4:E4").Font
.ColorIndex = xlAutomatic
End With
Sheets(c.Value).Protect
End With
Else
MsgBox "There are no Fields to print. Operation cancelled.", vbInformation, "Print
Cancelled"
Exit Sub
End If
Next
With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
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
How can Enter Page Numbers and/or page ranges separated by commas. d Excel Discussion (Misc queries) 1 December 3rd 08 03:41 PM
Setting the print area in page set up to print 1 page wide by 2 pages tall EA[_2_] Excel Discussion (Misc queries) 2 July 12th 07 08:39 PM
setting print ranges to print based on option bluegrassstateworker Excel Programming 4 May 5th 07 02:14 PM
Print Area ranges print on separate pages? Lyndon Excel Discussion (Misc queries) 1 December 29th 06 05:22 PM
how can I print non-adjacent ranges on one page steve Excel Discussion (Misc queries) 2 April 5th 06 04:36 PM


All times are GMT +1. The time now is 11:39 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"