Code for combobox that is comming from a list on a worksheet

PMRetired2012

Board Regular
Joined
Aug 6, 2019
Messages
123
What im wanting to do is write code for a combobox that picks up the list for the combobox on another worksheet in the workbook. I also want a loop set up to where when i add NEW items to that list they will show up when i click the arrow for the combobox. i will give you the information im using.
my combobox is combobox 2 and the worksheet with the list is named Sheet1.
I need ALL the code written for combobox2 to make this happen


Thanks
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
One way

Code below achieves what you want (for combobox placed on a userform )... using values in Sheet1, column B (starting at B2) - amend to match the range containing your list

VBA Code:
Private Sub ComboBox2_Enter()
    Dim Cel As Range, ws As Worksheet
    Set ws = Sheets("Sheet1")
    ComboBox2.Clear
    For Each Cel In ws.Range("B2", ws.Range("B" & Rows.Count).End(xlUp))
        ComboBox2.AddItem Cel
    Next Cel
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,895
Messages
6,122,128
Members
449,066
Latest member
Andyg666

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