D
Dave Peterson
One way:
Option Explicit
Sub testme()
Dim SheetList(1 To 6) As String
Dim sCtr As Long
sCtr = 0
If PhaseCheckBox.Value = True Then
sCtr = sCtr + 1
SheetList(sCtr) = "131 Phase1"
sCtr = sCtr + 1
SheetList(sCtr) = "131 Phase2"
End If
If ShopCheckBox.Value = True Then
sCtr = sCtr + 1
SheetList(sCtr) = "131 Shop1"
sCtr = sCtr + 1
SheetList(sCtr) = "131 Shop2"
End If
If RFCheckBox.Value = True Then
sCtr = sCtr + 1
SheetList(sCtr) = "RF"
End If
If StatusCheckbox.Value = True Then
sCtr = sCtr + 1
SheetList(sCtr) = "Status"
End If
If sCtr = 0 Then
'all the checkboxes were false
MsgBox "Nothing to print"
Else
'get rid of any unused elements in the array
ReDim Preserve SheetList(1 To sCtr)
Sheets(SheetList).PrintOut Copies:=1, Collate:=True
End If
End Sub
(untested)
Option Explicit
Sub testme()
Dim SheetList(1 To 6) As String
Dim sCtr As Long
sCtr = 0
If PhaseCheckBox.Value = True Then
sCtr = sCtr + 1
SheetList(sCtr) = "131 Phase1"
sCtr = sCtr + 1
SheetList(sCtr) = "131 Phase2"
End If
If ShopCheckBox.Value = True Then
sCtr = sCtr + 1
SheetList(sCtr) = "131 Shop1"
sCtr = sCtr + 1
SheetList(sCtr) = "131 Shop2"
End If
If RFCheckBox.Value = True Then
sCtr = sCtr + 1
SheetList(sCtr) = "RF"
End If
If StatusCheckbox.Value = True Then
sCtr = sCtr + 1
SheetList(sCtr) = "Status"
End If
If sCtr = 0 Then
'all the checkboxes were false
MsgBox "Nothing to print"
Else
'get rid of any unused elements in the array
ReDim Preserve SheetList(1 To sCtr)
Sheets(SheetList).PrintOut Copies:=1, Collate:=True
End If
End Sub
(untested)