+ Reply to Thread
Results 1 to 13 of 13

VBA Code for Print exclude not working

  1. #1
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    VBA Code for Print exclude not working

    Hi All

    I have the following codes for a print exclude that does not work - it should but prints out all sheets. Any Ideas Please.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Code for Print exclude not working

    Maybe:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: VBA Code for Print exclude not working

    Hi xladept

    Thanks for input....Unfortunately still prints all worksheets

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Code for Print exclude not working

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: VBA Code for Print exclude not working

    Hi Xladept

    Have generated 2 extra worksheets as Linka & Jenny...These are the to that I need to print via Userform "Print Payslips" button.
    Attached Files Attached Files

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: VBA Code for Print exclude not working

    Hi xladept

    I just noticed it is doing the same for populating of worksheets. It is also populating my exclusions Sheet 1-3.

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Code for Print exclude not working

    Hi sintek,

    It ran like a charm!

    Please Login or Register  to view this content.

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: VBA Code for Print exclude not working

    Hi xladept

    On my side, all the sheets are printed....(printpreviewed) and all my sheets are also populated by another macro where they should not be.....Am I doing something wrong as a whole cause the :

    Please Login or Register  to view this content.
    is not working as a whole.

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Code for Print exclude not working

    I see that the ws.name is case sensitive and in the sample you sent they are all upper case but your other program is proper case - try:

    Please Login or Register  to view this content.

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: VBA Code for Print exclude not working

    xladept....Works perfectly. Thanks

    I don't understand though.

  11. #11
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Code for Print exclude not working

    Hi sintek,

    The sheet names have to match exactly: DATABASE will not Match Database etc.

    So, by comparing a lower case sheet name with database we can get our match.

    Hope that's enough to explain. If not I'll try too be more explicit

    Orrin

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: VBA Code for Print exclude not working

    Now I understand...Awesome thanks for all input.

  13. #13
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Code for Print exclude not working

    Glad you got it! And, thanks for the rep!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Print Macro with exclude range
    By BelshazzarSP in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-20-2016, 01:01 AM
  2. [SOLVED] Private sub code no longer working (print area macro)
    By rikkyshh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-09-2013, 10:43 AM
  3. [SOLVED] seeking formula to exclude non working hours
    By jdgreen in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-14-2013, 05:19 PM
  4. Set Print Area Macro - Exclude Blank Rows
    By shudder in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-27-2009, 10:31 PM
  5. Code to print columns with active rows not working
    By debbiesh in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-11-2009, 05:14 PM
  6. Print to exclude fill colors on worksheets
    By jman0707 in forum Excel General
    Replies: 3
    Last Post: 10-07-2008, 12:50 PM
  7. Print Code not working
    By Sheeny in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2006, 10:30 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1