![]() |
|
#1
|
||||
|
||||
![]() Try: Code:
Private Sub CommandButton1_Click() Dim wkSht As Worksheet, Ctrl As Control, i As Long, ArrShts() ReDim Preserve ArrShts(0) For Each Ctrl In Me.Controls With Ctrl If .Name Like "CheckBox#*" Then If .Value = True Then ReDim Preserve ArrShts(i) ArrShts(i) = .Caption i = i + 1 End If End If End With Next If ArrShts(0) = 0 Then GoTo NoPrint With ActiveWorkbook Set wkSht = .ActiveSheet .Sheets(ArrShts).Select Application.Dialogs(xlDialogPrint).Show Arg1:=1, Arg4:=1, Arg5:=False, Arg6:=True, Arg7:=1 wkSht.Activate End With NoPrint: Unload UserForm1 End Sub Private Sub UserForm_Initialize() Dim Ctrl As Control, i As Long, ArrShts() ArrShts() = Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", _ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", _ "Jan (2)", "Feb (2)", "Mar (2)", "Apr (2)", "May (2)", "Jun (2)", _ "Jul (2)", "Aug (2)", "Sep (2)", "Oct (2)", "Nov (2)", "Dec (2)") For Each Ctrl In Me.Controls With Ctrl If .Name Like "CheckBox#*" Then .Caption = ArrShts(i) i = i + 1 End If End With Next End Sub If ArrShts(0) = 0 Then GoTo NoPrint
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
rvessio | Word VBA | 4 | 07-25-2016 12:37 PM |
Change single character in PPT to another font macro | rtwwpad | PowerPoint | 1 | 01-19-2013 05:08 PM |
![]() |
shabbaranks | Word VBA | 2 | 05-20-2011 01:02 AM |
Macro to Save Help | clarkson001 | Word | 0 | 02-14-2011 06:41 AM |
Macro Won't Save | lou0915 | Word VBA | 2 | 10-17-2009 08:13 PM |