austin350s10
Active Member
- Joined
- Jul 30, 2010
- Messages
- 321
I am using the below code on a userform that looks at which checkboxes the user ticked, which correspond the sheet names in the active workbook. Then prints out the sheets they selected.
My problem is that I would also like the user to be able to use the userform to enter the number of copies they want for a particular sheet into a textbox. With the script below I cant figure out how to use my print array to include multiple copies of sheets that the user wants.
Can this be done or does it need to be a separate printout statement?
My problem is that I would also like the user to be able to use the userform to enter the number of copies they want for a particular sheet into a textbox. With the script below I cant figure out how to use my print array to include multiple copies of sheets that the user wants.
Can this be done or does it need to be a separate printout statement?
Code:
Dim Sh As Worksheet
Dim arr() As String
Dim N, S As Integer
N = 0
Singles = Array(ckNA, ckOut, ckAsg, ckCP, ckHJ)
CheckBoxing = Array(ckMedLog, ckRespLog, ckBS, ckOutLog, ckPulseLog, ckBPLog, ckBSplus, ckSkinLog) 'These are the checkbox objects I would like the user to have the ability to make multiple copies of
Text = Array(n1, n2, n3, n4, n5, n6, n7, n8) ' This is the textbox array that correspond with the checkbox objects above
For Each Sh In ActiveWorkbook.Worksheets
For S = 0 To UBound(Singles)
If Singles(S).Value = True And Singles(S).Caption = Sh.Name Then
N = N + 1
ReDim Preserve arr(1 To N)
arr(N) = Sh.Name
End If
Next S
Next Sh
With ActiveWorkbook
.Worksheets(arr).PrintOut
End With
End Sub