jaeremata
New Member
- Joined
- Jan 20, 2021
- Messages
- 24
- Office Version
- 2019
- 2016
- Platform
- Windows
have a check box that has 4 sheets. It's working if I select 1 sheet and it's doing it's job.
But I'm having issue when 2 checkbox is selected. It open separate print job. What I want to happen is when when 2 sheets(or more) are selected on the checkbox, it will do a print preview but on one print job.
I don't know what I'm missing, please kindly point me or guide me to correct what needs to be done.
Here's my sample code:
Private Sub CommandButton1_Click()
If Me.cbSH1 = True Then
ThisWorkbook.Sheets("NC Performance").PrintPreview
End If
If Me.cbSH2 = True Then
ThisWorkbook.Sheets("8D Performance").PrintPreview
End If
If Me.cbSH3 = True Then
ThisWorkbook.Sheets("Attack Plan").PrintPreview
End If
If Me.cbSH4 = True Then
ThisWorkbook.Sheets("Plant Overview").PrintPreview
End If
If Me.cbSH1 And Me.cbSH2 = True Then
Sheets(Array("NC Performance", "8D Performance")).PrintPreview
End If
End Sub
But I'm having issue when 2 checkbox is selected. It open separate print job. What I want to happen is when when 2 sheets(or more) are selected on the checkbox, it will do a print preview but on one print job.
I don't know what I'm missing, please kindly point me or guide me to correct what needs to be done.
Here's my sample code:
Private Sub CommandButton1_Click()
If Me.cbSH1 = True Then
ThisWorkbook.Sheets("NC Performance").PrintPreview
End If
If Me.cbSH2 = True Then
ThisWorkbook.Sheets("8D Performance").PrintPreview
End If
If Me.cbSH3 = True Then
ThisWorkbook.Sheets("Attack Plan").PrintPreview
End If
If Me.cbSH4 = True Then
ThisWorkbook.Sheets("Plant Overview").PrintPreview
End If
If Me.cbSH1 And Me.cbSH2 = True Then
Sheets(Array("NC Performance", "8D Performance")).PrintPreview
End If
End Sub