Hello Clay,
I didn't forget about you. I have made the changes to the workbook as you requested. Here is the updated macro that has been added to the attached workbook.
Sub PrintData()
Dim Cell As Range
Dim DstWks As Worksheet
Dim NextRow As Long
Dim Rng As Range
Dim RngEnd As Range
Dim SrcWks As Worksheet
NextRow = 2
Set SrcWks = Worksheets("Cost Codes")
Set DstWks = Worksheets("Printout Data")
Set Rng = SrcWks.Range("B6")
Set RngEnd = SrcWks.Cells(Rows.Count, Rng.Column).End(xlUp)
Set Rng = IIf(RngEnd.Row < Rng.Row, Rng, SrcWks.Range(Rng, RngEnd))
Set Rng = Rng.Resize(ColumnSize:=8)
With DstWks.UsedRange
If .Rows.Count > 1 Then
.Offset(1, 0).Resize(RowSize:=.Rows.Count - 1).Clear
End If
End With
Application.ScreenUpdating = False
For Each Cell In Rng.Columns(7).Cells
If Val(Cell.Value) > 0 Or Val(Cell.Offset(0, 1)) > 0 Then
Rng.Rows(Cell.Row - Rng.Row + 1).Copy
DstWks.Cells(NextRow, "A").PasteSpecial Paste:=xlPasteValues
DstWks.Cells(NextRow, "A").PasteSpecial Paste:=xlPasteFormats
NextRow = NextRow + 1
End If
Next Cell
Application.ScreenUpdating = True
DstWks.PageSetup.CenterHeader = "&B" & Worksheets("Estimate Sheet").Range("I1")
DstWks.UsedRange.Columns.AutoFit
End Sub
Bookmarks