Add items to Combobox with named range

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,427
Office Version
  1. 2016
Platform
  1. Windows
I have a Combobox on a userform that I want to load from a named range, but with some criteria.

The range I need populated is A2 to the last used row, but only if the value in column B is "Family".

Possible?
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
How about
Code:
Private Sub UserForm_Initialize()

    Dim Cl As Range
    
    For Each Cl In Range("Names")
        If Cl.Offset(, 1).Value = "Family" Then
            Me.Combobox1.AddItem Cl.Value
        End If
    Next Cl
        

End Sub
This assumes your named range is Names
& that your Combo is ComboBox1
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,226,115
Messages
6,189,053
Members
453,522
Latest member
Seeker2025

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top