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
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