VBA combo box help

Dr.Evil925

New Member
Joined
Feb 24, 2011
Messages
22
I am trying to get 2 combo box's. The first one should populate with a list of headers and the second with the entries under the header picked in box 1.

Here is what i have so far and box 1 works but box 2 does not.

Private Sub CBName_Drop Button Click()
For Customer = 1 To 50
If Cells(1, Customer).Value = CBCustomer.Value Then
For Each NName In ws.Range("A2:A10")
With Me.CBName
.AddItem NName.Value
End With
Next NName
End If
Next Customer
End Sub

Private Sub UserForm_Initialize()
Dim Cust As Range
Dim ws As Worksheet
Set ws = Worksheets("Account DB")

For Each Cust In ws.Range("A1:M1")
With Me.CBCustomer
.AddItem Cust.Value
End With
Next Cust

The sheet might look like this.

Cust1 Cust2
Jim George

My end result would be for box 1 to show Cust1, and Cust2. with box 2 showing Jim, or George depending on which Cust i pick

Thanks
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,224,521
Messages
6,179,277
Members
452,902
Latest member
Knuddeluff

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