Hi,
I have a macro that will select multiple sheets at one point. I'm trying to think of a way to recall that selection later on, possibly by naming it when it's first selected. I thought something like this would work, but no dice:
SheetstoPrint = Sheets(ActiveWindow.SelectedSheets)
.....
.....
SheetstoPrint.Select
Also tried replacing "Sheets" with "Array" and that didn't work either.
I might be approaching this totally wrong, so here's the relevant part of the macro. I read elsewhere that you can't print while a dialog box is showing, so I'm trying to move the line that deletes the dialog box up in front of the PrintOut line.
' Display the dialog box
CurrentSheet.Activate
Application.ScreenUpdating = True
If SheetCount <> 0 Then
If PrintDlg.Show Then
For Each cb In PrintDlg.CheckBoxes
If cb.Value = xlOn Then
Worksheets(cb.Caption).Select Replace:=False
End If
Next cb
ActiveWorkook.SelectedSheets.PrintOut copies:=1
ActiveSheet.Select
End If
End If
' Delete temporary dialog sheet (without a warning)
Application.DisplayAlerts = False
PrintDlg.Delete
Thanks,
catdaddy1
I have a macro that will select multiple sheets at one point. I'm trying to think of a way to recall that selection later on, possibly by naming it when it's first selected. I thought something like this would work, but no dice:
SheetstoPrint = Sheets(ActiveWindow.SelectedSheets)
.....
.....
SheetstoPrint.Select
Also tried replacing "Sheets" with "Array" and that didn't work either.
I might be approaching this totally wrong, so here's the relevant part of the macro. I read elsewhere that you can't print while a dialog box is showing, so I'm trying to move the line that deletes the dialog box up in front of the PrintOut line.
' Display the dialog box
CurrentSheet.Activate
Application.ScreenUpdating = True
If SheetCount <> 0 Then
If PrintDlg.Show Then
For Each cb In PrintDlg.CheckBoxes
If cb.Value = xlOn Then
Worksheets(cb.Caption).Select Replace:=False
End If
Next cb
ActiveWorkook.SelectedSheets.PrintOut copies:=1
ActiveSheet.Select
End If
End If
' Delete temporary dialog sheet (without a warning)
Application.DisplayAlerts = False
PrintDlg.Delete
Thanks,
catdaddy1