Printing ranges error

S

Stuart

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top