Good Day,
I am trying to find the last row with data in it, then insert a number of rows.
The rows inserted will be different for the first page, then similar for every page after that. Basically if the data goes to more than one page I want to put in X rows so the table is filled on th second page, just to fill the page before printing.
The number of rows to insert will be different all the time, some times it doesn't need to insert any because the data fits on one page, other times it will need to insert a few.
Here is the code to date.
Any help is appreciated.
I am trying to find the last row with data in it, then insert a number of rows.
The rows inserted will be different for the first page, then similar for every page after that. Basically if the data goes to more than one page I want to put in X rows so the table is filled on th second page, just to fill the page before printing.
The number of rows to insert will be different all the time, some times it doesn't need to insert any because the data fits on one page, other times it will need to insert a few.
Here is the code to date.
Any help is appreciated.
Code:
Sub InsertBlankRows()
Dim LastRow As Range
Dim rng As Range
Dim CountTrue As Long
Set rng = Sheets("Checklist").Range("Work")
CountTrue = Application.WorksheetFunction.CountIf(rng, "True")
Page2 = CountTrue - 27
InsertRowDiff = 27 - Page2
With Sheets("Quote")
LastRow = Range("C" & Rows.Count).End(xlUp).row
Range("C:C" & LastRow).Resize(InsertRowDiff, 1).EntireRow.Insert
End With
End Sub