Checkboxes and Cobinations

S

Simon - M&M

Hi all,

The problem i have at the moment is that i have to produce 20 or so reports
into a trading pack for work. The way i have approached this is to use a
userform with 20 check boxes for each report. I want to be able for example
to select reports 1,5 and 19 and only print the selected reports. I would
like to know if there is an easy way of doing this than writing out the
thousands of different combinations in code, i.e Checkbox1.value = true and
Checkbox2.value = false etc,

Here is my code so far,
thanks very much for any help.

Private Sub CommandButton1_Click()
Copies = TextBox1.Value

If CheckBox1.Value = True Then
Workbooks.Open Filename:= _
"\\mm-fpvs-01\Home\sparrett\My Documents\Trading pack print
test\Report1.xls"
Else

If CheckBox2.Value = True Then
Workbooks.Open Filename:= _
"\\mm-fpvs-01\Home\sparrett\My Documents\Trading pack print
test\Report2.xls"

Else

If CheckBox3.Value = True Then
Workbooks.Open Filename:= _
"\\mm-fpvs-01\Home\sparrett\My Documents\Trading pack print
test\Report3.xls"

End If
End If
End If
Windows("MasterPrint.xls").Activate
Range("a1").Select
ActiveCell.Value = 0
Range("b1").Value = Copies


Do Until ActiveCell.Value = Range("b1").Value


If CheckBox1.Value = True Then
Windows("Report1.xls").Activate
ActiveWindow.Visible = True
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
MsgBox ("print1")

If CheckBox2.Value = True Then
Windows("Report2.xls").Activate
ActiveWindow.Visible = True
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
MsgBox ("print2")

If CheckBox3.Value = True Then
Windows("Report3.xls").Activate
ActiveWindow.Visible = True
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
MsgBox ("print3")
End If
End If
End If

Windows("MasterPrint.xls").Activate
ActiveCell.Offset(1, 0).Select
ActiveCell.Formula = "=r[-1]+1"

Loop

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top