+ Reply to Thread
Results 1 to 6 of 6

Select and Print Tables based on ListBox Selections

  1. #1
    Registered User
    Join Date
    08-09-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    22

    Select and Print Tables based on ListBox Selections

    Hi All,

    I have a worksheet that has multiple tables in it. The table names are based on the branch and the time of year. I'm trying to program something so that I can push a button and easily print multiple tables based on the ListBox selections.

    I have 2 ListBoxes; one for the branch and another for the quarter. I need to be able to select multiple branches and quarters and have it select the appropriate tables to print ie) if I select district A and B in the branch ListBox and Q1 and Q2 in the date ListBox, it will print tables A_Q1 & A_Q2 & B_Q1 & B_Q2.
    I can usually muddle my way through writing a macro, but this is the first time I have ever worked with UserForms or ListBoxes. I can probably work out the actual printing part of the macro, but I'm struggling with how to select the appropriate tables.

    I have the UserForm and ListBoxes set up properly (I think!). I attached what I have so far; I think the visual will better explain what I'm trying to do. I hope I have adequately explained everything, but if I need to clarify anything, please let me know. I'm working in Excel 2007. Any assistance would be greatly appreciated!

    Demo.xlsm

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Select and Print Tables based on ListBox Selections

    Hi Canadian_chickie

    Replace the UserForm Code with this. It appears to work for me. Please note, QuarterListBox is now a 2 Column ListBox.

    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    08-09-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Select and Print Tables based on ListBox Selections

    Hi John,

    Thank you so much, this is terrific! Could I bother you to help me with one small modification though please. I would like the print dialog box to appear instead of the document automatically printing. I tried changing the print section so the print dialog appears (which is does), but when I hit print, it's not printing the "report". I italicized the changes that I made; if you could show me where I went wrong, that would be great.

    Please Login or Register  to view this content.
    Last edited by canadian_chickie; 12-14-2015 at 11:14 AM.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Select and Print Tables based on ListBox Selections

    Hi Canadian_chickie

    Please wrap any Code you post in Code Tags.

    Try this
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-09-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Select and Print Tables based on ListBox Selections

    Whoops, sorry. Corrected.
    That did the trick. Thank you SO much for your help!

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Select and Print Tables based on ListBox Selections

    You're welcome...glad I could help.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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] Select Listbox entry based on another Listbox
    By fdsaw in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-18-2014, 08:13 AM
  2. [SOLVED] Select Range based on COmboBox selections
    By cmore in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-19-2013, 11:24 PM
  3. [SOLVED] filter based on listbox selections
    By mcdermott2 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-04-2013, 05:51 PM
  4. filter spreadsheet based on listbox selections
    By mcdermott2 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-04-2013, 02:50 PM
  5. How can I select multiple selections of pages for one print job
    By spira in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-24-2013, 11:34 PM
  6. userform listbox that lists data based on radio button selections
    By Shogun in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-09-2012, 10:46 AM
  7. Hide Rows Based on ListBox Selections
    By gsurge in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2011, 02:23 AM
  8. Select Multiple Tables With Listbox
    By bambino_32 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-28-2009, 09:41 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