+ Reply to Thread
Results 1 to 3 of 3

Preselecting userform listbox values

  1. #1
    Registered User
    Join Date
    08-03-2012
    Location
    Houston, TX
    MS-Off Ver
    Excel 2007
    Posts
    5

    Preselecting userform listbox values

    Good morning/afternoon,

    I have a listbox which allows a user to select multiple values. This popluates the workbook's active cell. For times when 10 items of a list of 500 may be selected, I don't want to have an editor of that cell to have to reselect almost all preselected values if they're only looking to remove one of the 10.

    How can I have the listbox open up with the activecell's values pre-selected? I've tried several solutions, none of which was I able to adapt. I'm not saying they're not adaptable. The problem lies with my skill.

    The code to populate the active cell is below. How can I reverse this to return the values to the listbox when it opens?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Preselecting userform listbox values

    Please Login or Register  to view this content.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    You'll need to split the values in the active cell out.

    That can be done with Split which returns an array.

    Then you'll need to loop through that array, find each values index (position) in the listbox and select it.

    You can use Application.Match to find the index of a value.
    If posting code please use code tags, see here.

+ 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. Searching for and returning values from a Listbox within a Userform
    By garden_gnome in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 10-20-2013, 12:08 PM
  2. [SOLVED] Changed userform combobox to listbox, unable to get userform to retrieve datasheet values
    By dragonabsurdum in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-29-2013, 01:38 PM
  3. Userform - make sure optionbutton and listbox has values
    By Masun in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-04-2013, 07:40 AM
  4. 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
  5. Userform's listbox values depending on values on certain matrix
    By Juhanen II in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-19-2008, 08:01 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