+ Reply to Thread
Results 1 to 6 of 6

Unhide 2nd Listbox when condition is met in the 1st multi-select listbox

  1. #1
    Forum Contributor
    Join Date
    05-12-2009
    Location
    Hendersonville, TN
    MS-Off Ver
    Excel 2010
    Posts
    113

    Unhide 2nd Listbox when condition is met in the 1st multi-select listbox

    Hello,

    I have been working this for a little bit now and not having much luck. I have a userform with 2 listboxes, both multi-select. When the form initializes, I have the 2nd listbox set visible=false. I am attempting to get listbox2 property to change to visible=true if listbox1 has "Electromyography (EMG)" selected with or without any other choices in listbox1.

    This is what I have that doesn't seem to work.

    Please Login or Register  to view this content.
    Thanks for your help.

    Patrick

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Unhide 2nd Listbox when condition is met in the 1st multi-select listbox

    Hi Patrick,

    Your code worked for me exactly as you wrote it.

    My speculation is that the actual value in the list box is NOT "Electromyography (EMG)" exactly. You probably have a leading or trailing space, or an extra embedded space or an extra Upper or Lower case character.

    Try the following which is included in the attached sample workbook.
    Please Login or Register  to view this content.
    Lewis

  3. #3
    Forum Contributor
    Join Date
    05-12-2009
    Location
    Hendersonville, TN
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Unhide 2nd Listbox when condition is met in the 1st multi-select listbox

    Thanks for the help Lewis. It appears however, that because my listbox is set to be a multi selection control, the code you sent will not work for this situation. I have been reading up a bit on this. I have yet to find a way to do this that I can truly wrap my head around. From what I see, I need to use a selection property that works with an index or array for the data in the listbox. My choice of interest ("Electromyography (EMG)") is in the 2 index position (3rd down from top). When the EMG selection is made, with or without other selections, is when I would like listbox2 to show itself.

    Any ideas on how to accomplish this?

    Thanks,
    Patrick

  4. #4
    Forum Contributor
    Join Date
    05-12-2009
    Location
    Hendersonville, TN
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Unhide 2nd Listbox when condition is met in the 1st multi-select listbox

    Well, I think I found my solution. Here is what I ended up with.
    Please Login or Register  to view this content.
    It seems to do what I wanted.

    Patrick
    Last edited by pjbassdc; 02-17-2015 at 02:26 PM.

  5. #5
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Unhide 2nd Listbox when condition is met in the 1st multi-select listbox

    It does what you want but it's not optimum, because it depends on EMG being the 3rd item.

    Try the following which will work for a Single or Multi Selection ListBox:
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    05-12-2009
    Location
    Hendersonville, TN
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Unhide 2nd Listbox when condition is met in the 1st multi-select listbox

    Yep. I like your code better. Thanks for the help Lewis.

    Patrick

+ 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] Find as you type in listbox control - solution for multi-column listbox - vba dictionary
    By wazimu13 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-05-2018, 03:42 AM
  2. [SOLVED] ListBox Multi-Select - Help
    By KyrieInfinity in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-08-2013, 12:54 AM
  3. Multi select Listbox Items selection based on other Listbox item selection.
    By srinivassathi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-20-2011, 05:53 AM
  4. Multi-Select ListBox
    By yawnzzzz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-17-2011, 08:55 AM
  5. Listbox Multi Select
    By MikeT in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-27-2006, 03:30 PM

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