ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Filtered Data for ComboBox (https://www.excelbanter.com/excel-programming/303029-using-filtered-data-combobox.html)

cdos

Using Filtered Data for ComboBox
 
I am pretty green when it comes to VBA, actually very green. But what
am looking for is some idea of what some code would look like for th
following:

Say I have 6 options to choose from in the first ComboBox, however eac
of those options have 10 subsets. What I am looking for is code tha
will adjust the second ComboBox to show the correct subsets based o
the first selected data in the first ComboBox.

Anything would help, if my description is too confusing please tell me
Thanks to anyone who takes the time to help me

--
Message posted from http://www.ExcelForum.com


Dave Peterson[_3_]

Using Filtered Data for ComboBox
 
I put a couple of comboboxes from the control toolbox toolbar on a worksheet.

I put the listfillrange for the first combobox on a different sheet.

Then in the code for that first combobox, I had this:

Option Explicit
Private Sub ComboBox1_Change()

Dim myCell As Range

With Me.ComboBox2
.Clear
For Each myCell In Application.Range(Me.ComboBox1.ListFillRange)
If myCell.Text = Me.ComboBox1.Value Then
.AddItem myCell.Offset(0, 1).Value
End If
Next myCell
End With

End Sub



"cdos <" wrote:

I am pretty green when it comes to VBA, actually very green. But what I
am looking for is some idea of what some code would look like for the
following:

Say I have 6 options to choose from in the first ComboBox, however each
of those options have 10 subsets. What I am looking for is code that
will adjust the second ComboBox to show the correct subsets based on
the first selected data in the first ComboBox.

Anything would help, if my description is too confusing please tell me.
Thanks to anyone who takes the time to help me.

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson



All times are GMT +1. The time now is 07:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com