Userform dependent combo boxes

jamescooper

Well-known Member
Joined
Sep 8, 2014
Messages
834
Have the following code to try that attempts to allow you to use the drop down in a userform which is dependent on the other. It is setup with an advanced filter in the spreadsheet. The problem I am encountering is that nothing shows in the dropdown box (combo box1), any ideas?

Thanks.

Code:
Private Sub ComboBox1_Change()


Dim r As Integer


r = 2


Range("F2").Value = ComboBox1.Value


Columns("C:D").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
 "F1:F2"), CopyToRange:=Range("H1:I1"), Unique:=False


ComboBox1.Clear


Do Until Cells(r, 9).Value = ""


ComboBox1.AddItem Cells(r, 9).Value
 r = r + 1


Loop


End Sub
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Put a break point on your DO line and then use F8 to step through the code. Have the Locals window visible to help monitor your variables

What is not happening as expected? Is there data appearing in cell I2 when you first hit this line of code? Is this reflected in the value of Cells(r,9).value when you hover the mouse over it? What about on any subsequent iterations of the loop?
 
Upvote 0

Forum statistics

Threads
1,214,634
Messages
6,120,659
Members
448,975
Latest member
sweeberry

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