Basically when I use this code to print it works great if there is a sheet to print, if there isn't a sheet to print I get a run time error, which isn't necessarily a big deal but for esthetic reasons I would like to have a dialog box come up that says "Sorry, nothing to print" if there is nothing to print.
Sub PrintAllTransfer()
Dim Sh As Worksheet
Dim Arr() As String
Dim N As Integer
N = 0
Application.ScreenUpdating = False
For Each Sh In ActiveWorkbook.Worksheets
If Sh.Range("A607").Value <> "" Then
N = N + 1
ReDim Preserve Arr(1 To N)
Arr(N) = Sh.Name
End If
Next
With ActiveWorkbook
For N = 1 To UBound(Arr)
If ActiveWorkbook.Worksheets(Arr(N)).Visible = xlSheetHidden Then
ActiveWorkbook.Worksheets(Arr(N)).Visible = xlSheetVisible
ActiveWorkbook.Worksheets(Arr(N)).PrintOut
ActiveWorkbook.Worksheets(Arr(N)).Visible = xlSheetHidden
Else
ActiveWorkbook.Worksheets(Arr(N)).PrintOut
End If
Next N
End With
Bookmarks