View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Printout sheets with a userform

Assume your have 10 checkboxes names checkbox1 to checkbox10 and 10 labels
with captions corresponding to the sheets and named label1 to label10 as an
example.

Dim i as Long, j as Long
Dim v as Variant
redim v(0 to )
j = 0
for i = 1 to 10
if Userform1.Controls("Checkbox" & i).Value then
redim preserve v(0,j)
v(j) = Userform1.Controls("Label" & i).Caption
end if
Next
sheets(v).Select


Adapt to fit your actual situation.

--
Regards,
Tom Ogilvy




"fragher75" wrote
in message ...

Hi,
I would printout some sheets with a user form. In this userform I put
checkboxes near the names of sheets, so when I select one or more
chechboxes I can printout (or preview) the sheet(s) selected.
If I record a macro, the multiselection of sheets is:

Sheets(Array("Sheet1", "Sheet2",
"Sheet3","Sheet4","Sheet5","Sheet6")).Select

but I have more combination of choose...

Can you help me?
Thanks


--
fragher75
------------------------------------------------------------------------
fragher75's Profile:

http://www.excelforum.com/member.php...o&userid=12360
View this thread: http://www.excelforum.com/showthread...hreadid=531184