Print selected lines from an arrary

Firesword

New Member
Joined
Oct 10, 2018
Messages
46
Office Version
  1. 2016
Platform
  1. Windows
Hi All

I need some help again.

I have a variable range from 1 to 200 (starting at row 14). I have a loop that will generate an array based on the criteria that I need. I then need to print this array to 13 lines per page. I have done a ceiling on UBound which will tell me how many pages I need to print. What I cannot fathom is how to print lines 1 - 13, then lines 14 - 26 and so on of the array.

Any help would be appreciated.

I will be passing values to this sub, but for testing purposes I've not done that, which is why the first few lines look odd
Code:
'Sub CreatePostCofC(lIndexNo, lFMENo, CofCSheet)
Sub CreatePostCofC()
'delete lines Top
Dim lIndexNo As Long
Dim strCofCsheet, lFMENo As String
strCofCsheet = Sheet18.Name
lIndexNo = 1756
lFMENo = "129/19/R"
Application.GoTo Reference:=Sheets(strCofCsheet).Range("B5")
'delete lines Bottom

Dim lLastRow, i As Long
Dim vPartNo, vDes, vQTY As Variant

    lLastRow = Sheets(Sheet12.Name).Range("A" & Rows.Count).End(xlUp).Row
    Sheet18.Cells(5, "B") = lFMENo
    Sheet18.Cells(11, "B") = Sheet12.Cells(6, "B")

        With Sheet12
            For i = 14 To lLastRow
                If .Cells(i, "H") = .Cells(5, "G") Then
                    If vPartNo = Empty Then
                        vPartNo = vPartNo & .Cells(i, "B")
                        vDes = vDes & .Cells(i, "C") & ", " & .Cells(i, "E") & ", " & .Cells(i, "F")
                        vQTY = vQTY & .Cells(i, "D")
                    Else
                        vPartNo = vPartNo & "¬" & .Cells(i, "B")
                        vDes = vDes & "¬" & .Cells(i, "C") & ", " & .Cells(i, "E") & ", " & .Cells(i, "F")
                        vQTY = vQTY & "¬" & .Cells(i, "D")
                    End If
                End If
            Next i
        End With
        vPartNo = Split(vPartNo, "¬")
        vDes = Split(vDes, "¬")
        vQTY = Split(vQTY, "¬")
    lCeiling = Application.WorksheetFunction.Sum(Application.WorksheetFunction.Ceiling(UBound(vPartNo, 1), 13) / 13)
End Sub
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,215,237
Messages
6,123,803
Members
449,127
Latest member
Cyko

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top