Thanks Thanks:  0
Likes Likes:  0
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Print only certain worksheets?--Excel experts pls help

  1. #11
    Board Regular Datsmart's Avatar
    Join Date
    Jun 2003
    Location
    Olympia
    Posts
    7,985
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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.
    John

  2. #12
    Board Regular
    Join Date
    Aug 2002
    Location
    Nashville, TN USA
    Posts
    188
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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!!

  3. #13
    Board Regular Datsmart's Avatar
    Join Date
    Jun 2003
    Location
    Olympia
    Posts
    7,985
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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.
    John

  4. #14
    Board Regular
    Join Date
    Aug 2002
    Location
    Nashville, TN USA
    Posts
    188
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

  5. #15
    Board Regular
    Join Date
    Aug 2002
    Location
    Nashville, TN USA
    Posts
    188
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Never mind...I changed it to an array and it worked. Thanks again for all your help!!

  6. #16
    Board Regular
    Join Date
    Aug 2002
    Location
    Nashville, TN USA
    Posts
    188
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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!

  7. #17
    Board Regular Datsmart's Avatar
    Join Date
    Jun 2003
    Location
    Olympia
    Posts
    7,985
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Use the code below to just bring up the Print Dialog box.
    Code:
    Application.Dialogs(xlDialogPrint).Show

  8. #18
    Board Regular
    Join Date
    Aug 2002
    Location
    Nashville, TN USA
    Posts
    188
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

  9. #19
    New Member
    Join Date
    Aug 2006
    Posts
    35
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

  10. #20
    Board Regular Datsmart's Avatar
    Join Date
    Jun 2003
    Location
    Olympia
    Posts
    7,985
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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.
    John

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •