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

I have the following macro below which worked fine until I added this line:

Selection.Interior.Color = 13434879 ' see below

It then all of a sudden printed 12 pages instead of 6 pages with the extra
being just blank lines.

What must I do to ONLY print the PRINT RANGE "rng" which sets ok on the screen

Sub Out()

' various routines which work ok

' Subtotal

Range("A2").Select
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(4), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
Cells.Select

' make subtotal lines BOLD

ActiveSheet.Outline.ShowLevels RowLevels:=2
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Font.Bold = True
Selection.Interior.Color = 13434879
ActiveSheet.Outline.ShowLevels RowLevels:=3


' Autofit column width

Cells.EntireColumn.AutoFit
Range("A2").Select

' Print

' Dim lastrow As Long, rng As Range (put in declarations)
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set rng = Range("A01:D" & lastrow)
rng.Select

ActiveSheet.PageSetup.LeftHeaderPicture.Filename = _
"\\shekel-srv\public\ù÷ì SHEKEL\LOGOonly.gif"
With ActiveSheet.PageSetup.LeftHeaderPicture
.Height = 77.25
.Width = 98.25
End With
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.CenterHeader = "&""-,Bold""&14øéëåæ ö'֎Ã*" & Chr(10) & "ùèøÃ* ðôøòå"
.RightHeader = "&""-,Bold""&14ù÷""ì"
.CenterFooter = "òîåã &P òã &N"
.RightFooter = "&D"
.LeftMargin = Application.InchesToPoints(0.708661417322835)
.RightMargin = Application.InchesToPoints(0.708661417322835)
.TopMargin = Application.InchesToPoints(1.18110236220472)
.BottomMargin = Application.InchesToPoints(0.78740157480315)
.HeaderMargin = Application.InchesToPoints(0.31496062992126)
.FooterMargin = Application.InchesToPoints(0.31496062992126)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
End With

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default Range Printing

Hi Helmut,

Try changing this :

Set rng = Range("A01:D" & lastrow)

To This ;

Set rng = Range("A2:D" & lastrow)

Note l have changed to row 2 because you have set row 1 for titles on
each page, additionally there is not a row01

Regards

Michael


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Range Printing

Hi Michael,
I tried this, but still get 12 instead of 6 pages.
Please note that if I take out: Selection.Interior.Color = 13434879
then I do get only 6 pages. Color coding seams to do something but don't
know what. May I send you both my xl & code file?

"michael.beckinsale" wrote:

Hi Helmut,

Try changing this :

Set rng = Range("A01:D" & lastrow)

To This ;

Set rng = Range("A2:D" & lastrow)

Note l have changed to row 2 because you have set row 1 for titles on
each page, additionally there is not a row01

Regards

Michael



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
Printing a named range RheaS Excel Discussion (Misc queries) 1 June 27th 07 07:28 PM
Printing the same range in a workbook nc Excel Programming 2 May 16th 07 05:51 PM
Printing Range Edgar[_3_] Excel Programming 1 April 2nd 04 04:33 PM
Printing A Range Bob[_44_] Excel Programming 1 December 30th 03 04:44 AM
Printing based on a value of a range Dave[_28_] Excel Programming 0 September 11th 03 04:34 PM


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