+ Reply to Thread
Results 1 to 13 of 13

Two column ComboBox Add from Named Ranges

  1. #1
    Registered User
    Join Date
    12-23-2019
    Location
    florida
    MS-Off Ver
    2016
    Posts
    13

    Question Two column ComboBox Add from Named Ranges

    I have a "Navigation UserForm on a project for 3 teams. I currently am using a single column ComboBox filing from a named range. It's used to set folders for saving reports generated by my main spreadsheet. Originally I was using the Supervisor-TeamLead as the name of the folder and the values in the range for the combobox. But with promotions/terminations...etc. That would not be wise. So what I want to do is use a second range, or even an array, to assign the value of 1, 2, 3 to the second column. Then store that in the string, based on user picking their "team." Currently the code I am using to load for the single column Combobox is as follows.

    Please Login or Register  to view this content.

    So For example if the combobox has Bob's Team, Tom's Team, Jane's Team in column 1, then Column 2 would contain 1, 2, 3. If I selected Tom's Team from the list, then I want my variable CTRteam to = 2.

    Thanks in advance.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,514

    Re: Two column ComboBox Add from Named Ranges

    Have you tried
    Please Login or Register  to view this content.
    ?
    Last edited by jindon; 01-23-2020 at 10:07 AM.

  3. #3
    Registered User
    Join Date
    12-23-2019
    Location
    florida
    MS-Off Ver
    2016
    Posts
    13

    Re: Two column ComboBox Add from Named Ranges

    Currently to get the value of the single column Combobox I am using...

    Please Login or Register  to view this content.
    And have set the column count of the combobox to 2 via the property dialog.

    Are you saying that the above would return the value of the second column?
    Last edited by TFlemingX; 01-23-2020 at 09:28 AM.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,514

    Re: Two column ComboBox Add from Named Ranges

    Hard to guess,,,
    Try something like
    Please Login or Register  to view this content.
    Sending from phone.

  5. #5
    Registered User
    Join Date
    12-23-2019
    Location
    florida
    MS-Off Ver
    2016
    Posts
    13

    Re: Two column ComboBox Add from Named Ranges

    I also found this option....would it do the same?

    Please Login or Register  to view this content.
    Also what is the easiest way to load the 1,2,3 in the second column? I know I need to use the .list option, but not 100% getting "how." lol

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,514

    Re: Two column ComboBox Add from Named Ranges

    You mean row serial number?

  7. #7
    Registered User
    Join Date
    12-23-2019
    Location
    florida
    MS-Off Ver
    2016
    Posts
    13

    Re: Two column ComboBox Add from Named Ranges

    Basically I have a Range on a hidden look-up worksheet. So Column looks like below.

    Bob
    Tom
    Jane

    Right now my code works fine to load those names into the combobox and pull the value using the code I've posted.
    I think the code I found will return the value of the 2nd column. So part two, getting the value, is solved. Part one, putting the value of 1, 2, 3 in that second column is where I am stuck.
    I want to either just auto added it via the VBA, or pull it from a second "range" on the look-up worksheet. Such as below.

    Bob 1
    Tom 2
    Jane 3

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,514

    Re: Two column ComboBox Add from Named Ranges

    Then add serial number next to the named range and use the code I first posted.

  9. #9
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: Two column ComboBox Add from Named Ranges

    Alternative, using Table ?
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    12-23-2019
    Location
    florida
    MS-Off Ver
    2016
    Posts
    13

    Re: Two column ComboBox Add from Named Ranges

    ok, TY, I will try that. To confirm I'm understanding the code you posted correctly. The "Resize(, 2).Value" is going pull both columns in my "range" and add them to column 0,1 of the Combobox "list." Is that correct? Also do I need to expand the Named Range to both columns or does that code not care about the boundaries of the Range?

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,514

    Re: Two column ComboBox Add from Named Ranges

    It doesn't matter as long as 2 columns are next to each other.

  12. #12
    Registered User
    Join Date
    12-23-2019
    Location
    florida
    MS-Off Ver
    2016
    Posts
    13

    Re: Two column ComboBox Add from Named Ranges

    TY works like a charm. Solves so many issues on my end. Again TY TY TY lol

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,514

    Re: Two column ComboBox Add from Named Ranges

    You are welcome.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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. Using vba to populate ComboBox list using named ranges
    By terriertrip in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 04-05-2018, 04:30 PM
  2. [SOLVED] Combobox combining 2 named ranges
    By gsandy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-12-2017, 03:33 PM
  3. [SOLVED] Add two Dynamic Named Ranges in userform combobox1. Show values on label1 from combobox se
    By svgopalareddy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2015, 10:54 AM
  4. [SOLVED] Add two Named Ranges in one ComboBox control
    By pipoliveira in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-24-2015, 11:53 AM
  5. Named Ranges to Column
    By RussB in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-04-2014, 05:18 AM
  6. Combobox with named ranges values to Textboxes
    By Kburges in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-21-2013, 12:42 PM
  7. [SOLVED] Named ranges and combobox
    By bigfoot007 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2012, 03:06 PM

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