Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 49972

Two column ComboBox Add from Named Ranges

$
0
0
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.

Code:

  Set wsLoc = Worksheets("LookupLists")

For Each cLoc In wsLoc.Range("Teams")
    With Me.CBteam
        .AddItem cLoc.Value
    End With
Next cLoc


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.

Viewing all articles
Browse latest Browse all 49972

Trending Articles