+ Reply to Thread
Results 1 to 4 of 4

Setting the selected row in a 2-column combobox on a userform

  1. #1
    Registered User
    Join Date
    04-04-2018
    Location
    Glasgow, Scotland
    MS-Off Ver
    MS 365
    Posts
    34

    Setting the selected row in a 2-column combobox on a userform

    My spreadsheet has a userform containing a two-column combo box. The second column of the row selected by the user is copied to the spreadsheet quite easily with:
    Please Login or Register  to view this content.
    But how do I do the reverse? If a choice already exists on the spreadsheet I want to pre-select that row of the combo box on the user form when it loads, but:

    Please Login or Register  to view this content.
    doesn't work. Do I have to iterate through the box until I've matched the cell value?
    Last edited by alansidman; 02-25-2019 at 04:39 AM. Reason: Code Tags Added

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Setting the selected row in a 2-column combobox on a userform

    You should be able to set the value

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    04-04-2018
    Location
    Glasgow, Scotland
    MS-Off Ver
    MS 365
    Posts
    34

    Re: Setting the selected row in a 2-column combobox on a userform

    That was my first thought but it doesn't work as the bound column (the one returned by cboMyCombo.value) is not the one I need to match. I've got it by iteration:

    Please Login or Register  to view this content.
    Also if it helps anyone else I've written my own 'NZ' function as Excel VBA doesn't have it:

    Please Login or Register  to view this content.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Setting the selected row in a 2-column combobox on a userform

    If the matching value is not the bound column then yes you will need to loop through and compare.

+ 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 combobox - setting up dependent values
    By adamstarr12 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-25-2014, 06:14 PM
  2. [SOLVED] How to recall last selected item in a userform combobox?
    By thedefense in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-06-2014, 10:09 AM
  3. [SOLVED] Pass Value of combobox selected in Userform as input to textbox of other userform
    By Pradeepg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-29-2013, 10:32 AM
  4. Edit a selected Combobox with another userform
    By clapforthewolfman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-02-2013, 04:20 AM
  5. [SOLVED] Goto cell selected from userform combobox
    By escobf in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2013, 05:28 PM
  6. [SOLVED] Combobox userform issue with setting WS
    By nickmax1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-15-2012, 07:02 AM
  7. display images on the userform when something out of a combobox is selected
    By Ghosty in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2012, 06:07 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