Print only certain worksheets?--Excel experts pls help

cjones88

New Member
Joined
Mar 14, 2002
Messages
23
I want to make a popup or some type of inquiry menu where it asks the user to specify which worksheets in the workbook to print. I have a data entry page, and four printable worksheets. Sometimes I only want to print two of the worksheets, but not the data page or the other two. Any way to do this besides printing the entire workbook or one worksheet at a time? It would be ideal if a popup menu came up with checkboxes for all of the available worksheets and the user could check off which ones to print.
 
Sarah,

You should not change the ".Name" portion of the code. That is refering to the NAME property of the sheet.
Your code has an apostrophe in front of the UserForm1.Show command. Remove that and try again.
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I made both corrections, and it looks like I am getting somewhere. But now when I click the button instead of doing nothing, I get an error that reads:
Run-time error'9':
Subscript out of range

What do you think I am doing wrong? I really appreciate your help on this!!
 
Upvote 0
Is your userform in fact named, "UserForm1"?
Try commenting out the initialization code by putting apostrophes infront of those lines to see if they are causing your error. Then troubleshoot from there.
 
Upvote 0
It was named UserForm1 in one place, but UserForm in another. Thanks for the tip!

I was able to make my macro work when only printing one sheet, but when I try to print multiple sheets, I get an error. I am refering to my sheets by name; do you have any ideas what could be causing the error?

If CheckBox1.Value = True Then Sheets("Total Summary, VZ Total Summary").PrintOut Copies:=1
 
Upvote 0
The people I work with are NEVER satisfied! (Can any of you relate??) the person I am building this model for is complaining because my print macro sends the file to his default printer. Is there a way when the macro runs to have it bring up the menu that comes up when you hit File, Print? The menu that lets you select your printer?

Thanks again for all your help!
 
Upvote 0
Use the code below to just bring up the Print Dialog box.
Code:
Application.Dialogs(xlDialogPrint).Show
 
Upvote 0
That brought up the print dialog screen, but when I selected my printer and clicked ok, nothing printed? Do I delete too much of the old command??

If CheckBox1.Value = True Then Sheets(Array("Total Summary", "VZ Total Summary")).Application.Dialogs(xlDialogPrint).Show
 
Upvote 0
This question is with regards to the print dialog box:
The following code pulls up the print dialog box, but when I press OK, it prints the page that my button for the macro is on and then it prints the sheets the macro is telling to print. How can I select what printer without printing the active sheet?

Code:
Application.Dialogs(xlDialogPrint).Show

Sheets(Array("Cover Page", "Enterprise Data", "Dash Board", "Per Share Metrics", "Profitability Trends", "VMC Profitability", "MLM Profitability", "FRK Profitability", "TXI Profitability", "RIN Profitability", "Balance Sheet", "ROCE (2)", "Dupont Analysis")).PrintOut Copies:=1
 
Upvote 0
The easy way would be to make one of the sheets you are printing "Active" prior to calling the Print Dialog box.
Like;
Code:
Sheets("Cover Page").Select
Then you can remove "Cover Page" from the Sheets to print code so you don't get two copies.
 
Upvote 0

Forum statistics

Threads
1,215,035
Messages
6,122,791
Members
449,095
Latest member
m_smith_solihull

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