• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro to select the worksheets to Print

JohnBi

New Member
Hallo to everybody,

based on this sample

https://www.dropbox.com/s/7o0rwfws2c2m6v3/Print_Using_ListBox2.xlsm

how is possibile to print the selected sheets as single job?


Thanks for your help and as I am new to this forum, congratulation for the hi level of knowledge of Excel.

Regards

JohbBi
 
Hi, JohnBi!


Give a look at this file:

https://dl.dropboxusercontent.com/u/60558749/Macro%20to%20select%20the%20worksheets%20to%20Print%20-%20Print_Using_ListBox2%20%28for%20JohnBi%20at%20chandoo.org%29.xlsm


This is the updated code for the Print button of the userform:

-----

[pre]
Code:
Private Sub PrintButton1_Click()
Dim i As Integer, j As Integer, v As Variant

'Close userform
UserForm1.Hide

With ListBox1
j = 0
For i = 0 To .ListCount - 1
If .Selected(i) Then
j = j + 1
If j > 1 Then ReDim Preserve v(1 To j) Else ReDim v(1 To j)
v(j) = Worksheets(.List(i)).Name
End If
Next i
If j <> 0 Then
Worksheets(v).Select
If CheckBox1 Then
ActiveWindow.SelectedSheets.PrintPreview 'for debugging
Else
ActiveWindow.SelectedSheets.PrintOut
End If
End If

End With

End Sub
[/pre]
-----


Just advise if any issue.


Regards!


PS: Variable names and indentation kept as original.
 
Hi SirJB7 ! Pas de souci !


(Hakuna Matata ! [No problemo ! from Swahili and in The Lion King !])
 
Hi, JohnBi!

Glad you solved it. Thanks for your feedback and for your kind words too. And welcome back whenever needed or wanted.

Regards!


@Marc L

Hi!

Merci bien, monsieur. (Fine, thanks)

Regards!
 
Back
Top