VBA Code- All Sheets Printing At once with select option

harinsh

Active Member
Joined
Feb 7, 2012
Messages
273
Hi Team,

In my office every day I am printing one file which is containing 10 different sheets. Every time I need to select the sheet and print it. Is there any way to print at once? Not require to select print one by one. Please note that it is not necessarily to print all sheets it is depends on our requirement & schedule.

Kindly help me in order to executive the above requirements and provide macro codes for this.

Thanks,
Harish Kumar
 
Last edited:

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Try selecting the tabs you want to print before printing, if they're next to each other select them by holding down the shift key while you click on the first, then the last. If they're not all next to each other, hold the ctrl key down while selecting the individual sheet's tabs to be printed
 
Upvote 0
Thanks p45cal for your reply.

I will try with this by tomorrow but can we create this in forms in order to make it easier to select by user which ever he want to print the sheet.
 
Upvote 0
Thanks p45cal for your reply.

I will try with this by tomorrow but can we create this in forms in order to make it easier to select by user which ever he want to print the sheet.
Absolutely there is, but I don't have time just now.
 
Upvote 0
Thanks p45cal!

Ok..fine Just help in order select the one sheet by using 'Check Box' (code) so, that I will try to create rest of things!!!
 
Upvote 0
You will need to add a userfrom, add a listbox to it, set its MultiSelect property to 1, set its listStyle to 1.
In the initialize event of the userform have something like:
Code:
Private Sub UserForm_Initialize()
For Each sht In ThisWorkbook.Worksheets
  ListBox1.AddItem sht.Name
Next sht
End Sub
and a command button with this code attached:
Code:
Private Sub CommandButton1_Click()
FirstOne = True
For i = 0 To ListBox1.ListCount - 1
  If ListBox1.Selected(i) Then
    ThisWorkbook.Sheets(ListBox1.List(i)).Select IIf(FirstOne, True, False)
    FirstOne = False
  End If
Next i
Unload Me
ThisWorkbook.PrintPreview
End Sub
as well as buttons to cancel the operation. Also something to bring up the form, either in the before_print event or a dedicated button for it.

Sorry, I'm really out of time now.
 
Upvote 0

Forum statistics

Threads
1,216,098
Messages
6,128,812
Members
449,468
Latest member
AGreen17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top