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

Hi,
I am printing 5 different ranges using the code below (which works fine).
Each range is printed on a different page. I would like also to print range
(h3:o6) on all the pages. Any idea how to do that? Thanks



Dim W As Worksheet
Set W = Worksheets("Patients Data")

Dim Rg As Range
Set Rg = Worksheets("Print Data").Range("PrintCheckPatients")

Dim i%

Dim x As Range
Dim asRangeNames(1 To 10)
asRangeNames(1) = "$F$5"
asRangeNames(2) = "$F$180"
asRangeNames(3) = "Country1"
asRangeNames(4) = "Country2"
asRangeNames(5) = "Country3"
asRangeNames(6) = "Country4"
asRangeNames(7) = "Country5"
asRangeNames(8) = "Country6"
asRangeNames(9) = "Country7"
asRangeNames(10) = "Country8"

Dim y As Range
Dim asRangeNamesC(1 To 10)
asRangeNamesC(1) = "PrintCheckb"
asRangeNamesC(2) = "PrintCheckc"
asRangeNamesC(3) = "PrintCheck1"
asRangeNamesC(4) = "PrintCheck2"
asRangeNamesC(5) = "PrintCheck3"
asRangeNamesC(6) = "PrintCheck4"
asRangeNamesC(7) = "PrintCheck5"
asRangeNamesC(8) = "PrintCheck6"
asRangeNamesC(9) = "PrintCheck7"
asRangeNamesC(10) = "PrintCheck8"

With W.PageSetup
.Orientation = xlLandscape
.Zoom = 80
End With

If Rg = Int(True) Then

'PROCEDURE
For i = 1 To UBound(asRangeNames)

Set x = W.Range(asRangeNames(i))
Set y = Worksheets("Print Data").Range(asRangeNamesC(i))


If y.Value = Int(True) Then

W.PageSetup.PrintArea = Union(Range(x.Offset(2, 0), x.Offset(35, 9)), _
Range(x.Offset(37, 0), x.Offset(69, 9)), _
Range(x.Offset(71, 0), x.Offset(103, 9)), _
Range(x.Offset(105, 0), x.Offset(137, 9)), _
Range(x.Offset(140, 0), x.Offset(172, 9))).Address
W.PrintOut Copies:=1, Collate:=True

End If

Next i


End If


End Sub

--
caroline
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Print titles

Caroline

You can set the printtitlerows property for the pagesetup but this prints
rows and not ranges as in:

ActiveSheet.PageSetup.PrintTitleRows = "$3:$6"

Otherwise you can modify the worksheet before you print it, insert the area
to be printed in the five regions and then print and then remove the regions.


--
Hope this helps
Martin Fishlock


"caroline" wrote:

Hi,
I am printing 5 different ranges using the code below (which works fine).
Each range is printed on a different page. I would like also to print range
(h3:o6) on all the pages. Any idea how to do that? Thanks



Dim W As Worksheet
Set W = Worksheets("Patients Data")

Dim Rg As Range
Set Rg = Worksheets("Print Data").Range("PrintCheckPatients")

Dim i%

Dim x As Range
Dim asRangeNames(1 To 10)
asRangeNames(1) = "$F$5"
asRangeNames(2) = "$F$180"
asRangeNames(3) = "Country1"
asRangeNames(4) = "Country2"
asRangeNames(5) = "Country3"
asRangeNames(6) = "Country4"
asRangeNames(7) = "Country5"
asRangeNames(8) = "Country6"
asRangeNames(9) = "Country7"
asRangeNames(10) = "Country8"

Dim y As Range
Dim asRangeNamesC(1 To 10)
asRangeNamesC(1) = "PrintCheckb"
asRangeNamesC(2) = "PrintCheckc"
asRangeNamesC(3) = "PrintCheck1"
asRangeNamesC(4) = "PrintCheck2"
asRangeNamesC(5) = "PrintCheck3"
asRangeNamesC(6) = "PrintCheck4"
asRangeNamesC(7) = "PrintCheck5"
asRangeNamesC(8) = "PrintCheck6"
asRangeNamesC(9) = "PrintCheck7"
asRangeNamesC(10) = "PrintCheck8"

With W.PageSetup
.Orientation = xlLandscape
.Zoom = 80
End With

If Rg = Int(True) Then

'PROCEDURE
For i = 1 To UBound(asRangeNames)

Set x = W.Range(asRangeNames(i))
Set y = Worksheets("Print Data").Range(asRangeNamesC(i))


If y.Value = Int(True) Then

W.PageSetup.PrintArea = Union(Range(x.Offset(2, 0), x.Offset(35, 9)), _
Range(x.Offset(37, 0), x.Offset(69, 9)), _
Range(x.Offset(71, 0), x.Offset(103, 9)), _
Range(x.Offset(105, 0), x.Offset(137, 9)), _
Range(x.Offset(140, 0), x.Offset(172, 9))).Address
W.PrintOut Copies:=1, Collate:=True

End If

Next i


End If


End Sub

--
caroline

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

thanks Martin
--
caroline


"Martin Fishlock" wrote:

Caroline

You can set the printtitlerows property for the pagesetup but this prints
rows and not ranges as in:

ActiveSheet.PageSetup.PrintTitleRows = "$3:$6"

Otherwise you can modify the worksheet before you print it, insert the area
to be printed in the five regions and then print and then remove the regions.


--
Hope this helps
Martin Fishlock


"caroline" wrote:

Hi,
I am printing 5 different ranges using the code below (which works fine).
Each range is printed on a different page. I would like also to print range
(h3:o6) on all the pages. Any idea how to do that? Thanks



Dim W As Worksheet
Set W = Worksheets("Patients Data")

Dim Rg As Range
Set Rg = Worksheets("Print Data").Range("PrintCheckPatients")

Dim i%

Dim x As Range
Dim asRangeNames(1 To 10)
asRangeNames(1) = "$F$5"
asRangeNames(2) = "$F$180"
asRangeNames(3) = "Country1"
asRangeNames(4) = "Country2"
asRangeNames(5) = "Country3"
asRangeNames(6) = "Country4"
asRangeNames(7) = "Country5"
asRangeNames(8) = "Country6"
asRangeNames(9) = "Country7"
asRangeNames(10) = "Country8"

Dim y As Range
Dim asRangeNamesC(1 To 10)
asRangeNamesC(1) = "PrintCheckb"
asRangeNamesC(2) = "PrintCheckc"
asRangeNamesC(3) = "PrintCheck1"
asRangeNamesC(4) = "PrintCheck2"
asRangeNamesC(5) = "PrintCheck3"
asRangeNamesC(6) = "PrintCheck4"
asRangeNamesC(7) = "PrintCheck5"
asRangeNamesC(8) = "PrintCheck6"
asRangeNamesC(9) = "PrintCheck7"
asRangeNamesC(10) = "PrintCheck8"

With W.PageSetup
.Orientation = xlLandscape
.Zoom = 80
End With

If Rg = Int(True) Then

'PROCEDURE
For i = 1 To UBound(asRangeNames)

Set x = W.Range(asRangeNames(i))
Set y = Worksheets("Print Data").Range(asRangeNamesC(i))


If y.Value = Int(True) Then

W.PageSetup.PrintArea = Union(Range(x.Offset(2, 0), x.Offset(35, 9)), _
Range(x.Offset(37, 0), x.Offset(69, 9)), _
Range(x.Offset(71, 0), x.Offset(103, 9)), _
Range(x.Offset(105, 0), x.Offset(137, 9)), _
Range(x.Offset(140, 0), x.Offset(172, 9))).Address
W.PrintOut Copies:=1, Collate:=True

End If

Next i


End If


End Sub

--
caroline

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
Print Titles MM Excel Discussion (Misc queries) 1 February 11th 10 12:30 AM
Print Error Message: Print titles must be contiguous and complete sum1029 Excel Discussion (Misc queries) 1 September 16th 09 07:27 PM
Print Titles RobinT50 Excel Worksheet Functions 3 May 27th 08 03:02 PM
print titles Crazyman Excel Discussion (Misc queries) 0 June 6th 07 11:00 PM
Print titles Roger Bedford Excel Discussion (Misc queries) 1 December 12th 04 08:35 AM


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