+ Reply to Thread
Results 1 to 6 of 6

Dynamically Unhide Sheets with a Userform Listbox

  1. #1
    Registered User
    Join Date
    09-27-2015
    Location
    AZ
    MS-Off Ver
    2010
    Posts
    23

    Dynamically Unhide Sheets with a Userform Listbox

    I have a listbox that is populated dynamically by hidden tab names that start with the name "TEMP".

    Please Login or Register  to view this content.
    Then I have a button that is linked to the following Sub. When clicked each selected item in the listbox unhides the corresponding sheet.

    Please Login or Register  to view this content.
    This method works. But I would like the sheets to hide/unhide dynamically without having to click a button. I have tried a few methods using ListBoxTemp_Click(), but can not get it to work properly.

    Any thoughts on how to accomplish this?

  2. #2
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,168

    Re: Dynamically Unhide Sheets with a Userform Listbox

    Problem I see is that when does vba know when you have made your last selection - possibly doubleclick on last selection or on exiting listbox or userform.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    09-27-2015
    Location
    AZ
    MS-Off Ver
    2010
    Posts
    23

    Re: Dynamically Unhide Sheets with a Userform Listbox

    Thanks for the reply! This solution could work as a good alternative.

    My thoughts were the loop would run every time an item is clicked on (either selected or unselected). For example, the user holds CTRL and clicks the 1st, 2nd and 3rd item to selects them. On each click the corresponding selection would unhide the tab. If the user clicked a forth time on the 1st item to unselect it, it would hid the tab when clicked. So for this example the loop would be run 4 times. Is this possible?

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    9,526

    Re: Dynamically Unhide Sheets with a Userform Listbox

    How about making the listbox single select & use this
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-27-2015
    Location
    AZ
    MS-Off Ver
    2010
    Posts
    23

    Re: Dynamically Unhide Sheets with a Userform Listbox

    Thank you for your help on this!

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    9,526

    Re: Dynamically Unhide Sheets with a Userform Listbox

    You're welcome

+ 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. Get data from two sheets and display in listbox on UserForm
    By olypro in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 01-24-2019, 04:04 AM
  2. [SOLVED] Userform Multi-Select Listbox Selection Condition to unhide Frame and controls
    By pjbassdc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2016, 10:05 AM
  3. [SOLVED] Unhide 2nd Listbox when condition is met in the 1st multi-select listbox
    By pjbassdc in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-18-2015, 09:58 AM
  4. Populating listbox values of userform dynamically in the Access table fields
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-07-2014, 06:52 AM
  5. Replies: 4
    Last Post: 08-15-2014, 04:02 PM
  6. Listbox to Listbox, no duplicates & submitting same UserForm data for each Listbox entry.
    By jamieswift1977 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-18-2012, 12:18 PM
  7. Adding Sheets to ListBox in Userform
    By zimbo109 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-23-2010, 08:31 AM

Tags for this Thread

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