So, if I understand you correctly, you would like a macro that allows
you to define the order of printing of the sheets and then prints them
in that order. If so, here's what you can do:
1. This code will list all the sheets and ask you to input a print
order number in the cell to the right of that sheet name:
Sub ListSheets()
Dim intSht As Integer
Application.ScreenUpdating = False
' Create new sheet
On Error Resume Next
Sheets("Sheet List").Activate
If Err.Number < 0 Then
Sheets.Add
ActiveSheet.Name = "Sheet List"
Else
Sheets("Sheet List").Cells.Delete
End If
Err.Clear
On Error GoTo 0
' Create headings
Range("A1").Value = "Sheet Name"
Range("B1").Value = "Print Order"
' List sheets (except Sheet List)
intSht = 2
For Each sht In Sheets
If sht.Name < "Sheet List" Then
Range("A" & intSht).Value = sht.Name
intSht = intSht + 1
End If
Next sht
ActiveSheet.Cells.EntireColumn.AutoFit
Application.ScreenUpdating = True
End Sub
2. Once you have determined the print order and typed it in, run this
macro.
Sub PrintInOrder()
Application.ScreenUpdating = False
' Make sure the list is there.
On Error Resume Next
Sheets("Sheet List").Activate
If Err.Number < 0 Then
MsgBox ("Please run the ListSheets subroutine first.")
Exit Sub
End If
' Make sure the print order is input.
If WorksheetFunction.CountA(Range("B:B")) <
WorksheetFunction.CountA(Range("A:A")) Then
MsgBox ("You must input all print orders. Please do so and
re-run this macro.")
Exit Sub
End If
On Error GoTo 0
Range("A:B").Sort Key1:=Range("B:B"), Order1:=xlAscending,
Header:=xlYes
For x = 2 To ActiveSheet.UsedRange.SpecialCells(xlLastCell).Row
Sheets(Range("A" & x).Value).Print
Next x
Application.DisplayAlerts = False
Sheets("Sheet List").Delete
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
If you have any problems, please let me know.
Mark
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!