![]() |
Printing ranges error
I have a print routine where an array holds the ranges/pages to
be printed. rng1 is the range/page, and it is loaded into an array (printvarr) as follows: For Each ws In ActiveWorkbook.Worksheets() With ws 'Build an array of the ranges to be printed in this sheet ReDim Printvarr(1 To 1) For j = 1 To UBound(Pagevarr) - 1 Set rng1 = .Range(Pagevarr(j), Pagevarr(j + 1) _ .Offset(-1, 0)).Resize(, ColsToPrint) ' rng1.Copy 'used to visually check the correct range was copied If IsEmpty(Printvarr(1)) Then Set Printvarr(1) = rng1 Else ReDim Preserve Printvarr(1 To UBound(Printvarr) + 1) Set Printvarr(UBound(Printvarr)) = rng1 End If Next ' At this point rng1 is correctly defined and ColToPrint = 7 If Not IsEmpty(Printvarr(1)) Then With ActiveSheet.PageSetup .Zoom = False .LeftMargin = 0 .RightMargin = 0 .TopMargin = 0 .BottomMargin = 0 .HeaderMargin = 0 .FooterMargin = 0 .CenterHorizontally = True .CenterVertically = True If ColsToPrint 7 Then .Orientation = xlLandscape Else .Orientation = xlPortrait End If End With For i = 1 To UBound(Printvarr) ' with £Col = 6 If Not (IsEmpty(Pagevarr(i + 1).Offset(-1, £Col)) Or _ IsEmpty(Pagevarr(i + 1).Offset(-1, £Col)) _ Or Pagevarr(i + 1).Offset(-1, £Col).Value _ = "0.00") Then 'for testing ... toggle as required Printvarr(i).PrintPreview 'Printvarr(i).PrintOut End If Next End If End With Next rng1 shows columns A to G being in the range, but PrintPreview only shows A to F. Why is this, please? Regards. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.688 / Virus Database: 449 - Release Date: 18/05/2004 |
All times are GMT +1. The time now is 06:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com