Thursday, September 5, 2013

Excel VBA - Print all Worksheets in a Workbook

A simple code snippet that can be used to print all Worksheets in an Excel Workbook is as follows:
Sub PrintAllSheets()
    Application.DisplayAlerts = False
         Dim WS_Count As Integer
         Dim I As Integer
         ' Set WS_Count equal to the number of worksheets in the active
         WS_Count = ActiveWorkbook.Worksheets.Count
         For I = 1 To WS_Count
            ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
        End If
    Next I
End Sub

No comments:

Post a Comment