I posted this in the general forum before seeing that this forum exists.
I have a spreadsheet that contains a header column in column A. I need a macro that will print each column starting with column B on a seperate page until it reaches a column with no data and then stop.
I have compiled the script below from doing various searches, but it is not stoping when there ceases to be column data. Can someone help in tweaking this to work?
Thanks so much!
Sub APPPRINT()
'
' APPPRINT Macro
'
Dim rng As Range
For Each rng In Range(Range("A:ZZ"), Cells(Columns.Count, "A").End(xlUp))
With rng.Parent
.PageSetup.PrintArea = rng.EntireColumn.Address
'.PrintOut 'remove the apostrophy
.PrintPreview 'Add an appostrophy
End With
Next rng
Dim awf As WorksheetFunction: Set awf = WorksheetFunction
Dim lLR As Long: lLR = Range("A" & Rows.Count).End(xlUp).Row
Dim CheckRows As Long
CheckRows = awf.Subtotal(103, Range("A2:A" & lLR))
If CheckRows = 0 Then
MsgBox "No rows selected", , "Print Check"
Exit Sub
End If
MsgBox "Printing", , "Print Check"
End Sub
Bookmarks