+ Reply to Thread
Results 1 to 6 of 6

Get selections of multi select listbox on a userform

  1. #1
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,496

    Get selections of multi select listbox on a userform

    I have a multiselect listbox with the headers of a sheet on a userform.
    The idea is to select two headers, get their column numbers and put them in a variable to use later as a range.

    Please Login or Register  to view this content.
    I have it working with this but I should be able to do it with the listbox, shouldn't I?
    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,570

    Re: Get selections of multi select listbox on a userform

    If you mean by "userform", just a worksheet and not a VBA userform, shouldn't the listbox items positions in the list correspond to the column on the form (left to right)? For example, if the first header is in column D, then selecting it, i = 0 and so you can just add four (in this case) for the column number.
    Ben Van Johnson

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Get selections of multi select listbox on a userform

    How have you populated the listbox with the headers?
    If posting code please use code tags, see here.

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,496

    Re: Get selections of multi select listbox on a userform

    Hi Ben
    No, it is a ListBox on a VBA UserForm
    Would yo be able to do add the difference on a UserForm ListBox? If you would for instance select Column 4 and the 2nd column would be column 33, how would you know the difference?
    I am open to all kind of suggestions.


    Hi Norie.
    The listbox is populated as follows:
    Please Login or Register  to view this content.
    Thanks for helping Ben and Norie

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Get selections of multi select listbox on a userform

    Not sure what you are having problems with but if you wanted to find the column number for each of the selected headers in the listbox you could use something like this.
    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,496

    Re: Get selections of multi select listbox on a userform

    There you go. As usual, right on.
    Thank you both.

+ 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] 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
  2. [SOLVED] Delay in loading selections in userform listbox
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-18-2016, 08:49 PM
  3. [SOLVED] Select and Print Tables based on ListBox Selections
    By canadian_chickie in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-14-2015, 01:05 PM
  4. [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
  5. [SOLVED] Extracting mulitple selections from a multi column listbox
    By BeginnerVBA in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-01-2014, 04:55 PM
  6. [SOLVED] Clear UserForm Multi Select ListBox
    By jaslake in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-20-2014, 12:19 AM
  7. [SOLVED] userform Multi select listbox - add contents to list
    By tbar05 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 03-25-2013, 10:25 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