The macro below is designed to print several reports. It prints a report for each ID number listed in a specific column. It works fine except when the print box opens the cancel button does not work. If I decide I want to change something and hit cancel it prints anyways. Can anyone help solve how I can get the cancel button to stop printing and just cancel? Please keep in mind I am a beginner with VBA. Thanks for any help.
Dim endrow As Long
Application.Dialogs(xlDialogPrinterSetup).Show
endrow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 To endrow
If Cells(i, 1).Value <> "" And Cells(i, 1).Value <> " " Then
Range("L6").Value = Cells(i, 1).Value
Sheets("Report").PrintOut Copies:=1, Collate:=True
End If
Next i
End Sub
Bookmarks