Hello! I hope someone can help me. I am desperately trying to accomplish the following;
I have an userform(FormEntry) with 6 combo boxes. However, all 6 combo boxes reference the same range(Courses) under column "C" in sheet(Ranges-Lists). What I need is for the boxes to continue referencing the same range(Courses) under column "C", but that if the selection on the first combo box is "math", then the remaining combo boxes will no longer have "math" as an option.
I currently have VBA set up to "ignore blank cells" within a range. I wish to maintain that, but also add the function mentioned above; I need combo box 6 to have 5 less options than what combo box 1 had available.
This is the code that I currently have, which works perfect(with the exception of leaving out prior choices):
With Worksheets("Ranges-Lists")
For Each cell In .Range("C2:C50" & .Cells(Rows.Count, 3).End(xlUp).Row)
If Not IsEmpty(cell) Then Courses1.AddItem cell.Value
Next cell
End With
With Worksheets("Ranges-Lists")
For Each cell In .Range("C2:C50" & .Cells(Rows.Count, 3).End(xlUp).Row)
If Not IsEmpty(cell) Then Courses2.AddItem cell.Value
Next cell
End With
With Worksheets("Ranges-Lists")
For Each cell In .Range("C2:C50" & .Cells(Rows.Count, 3).End(xlUp).Row)
If Not IsEmpty(cell) Then Courses3.AddItem cell.Value
Next cell
End With
With Worksheets("Ranges-Lists")
For Each cell In .Range("C2:C50" & .Cells(Rows.Count, 3).End(xlUp).Row)
If Not IsEmpty(cell) Then Courses4.AddItem cell.Value
Next cell
End With
With Worksheets("Ranges-Lists")
For Each cell In .Range("C2:C50" & .Cells(Rows.Count, 3).End(xlUp).Row)
If Not IsEmpty(cell) Then Courses5.AddItem cell.Value
Next cell
End With
With Worksheets("Ranges-Lists")
For Each cell In .Range("C2:C50" & .Cells(Rows.Count, 3).End(xlUp).Row)
If Not IsEmpty(cell) Then Courses6.AddItem cell.Value
Next cell
End With
End Sub
I have an userform(FormEntry) with 6 combo boxes. However, all 6 combo boxes reference the same range(Courses) under column "C" in sheet(Ranges-Lists). What I need is for the boxes to continue referencing the same range(Courses) under column "C", but that if the selection on the first combo box is "math", then the remaining combo boxes will no longer have "math" as an option.
I currently have VBA set up to "ignore blank cells" within a range. I wish to maintain that, but also add the function mentioned above; I need combo box 6 to have 5 less options than what combo box 1 had available.
This is the code that I currently have, which works perfect(with the exception of leaving out prior choices):
With Worksheets("Ranges-Lists")
For Each cell In .Range("C2:C50" & .Cells(Rows.Count, 3).End(xlUp).Row)
If Not IsEmpty(cell) Then Courses1.AddItem cell.Value
Next cell
End With
With Worksheets("Ranges-Lists")
For Each cell In .Range("C2:C50" & .Cells(Rows.Count, 3).End(xlUp).Row)
If Not IsEmpty(cell) Then Courses2.AddItem cell.Value
Next cell
End With
With Worksheets("Ranges-Lists")
For Each cell In .Range("C2:C50" & .Cells(Rows.Count, 3).End(xlUp).Row)
If Not IsEmpty(cell) Then Courses3.AddItem cell.Value
Next cell
End With
With Worksheets("Ranges-Lists")
For Each cell In .Range("C2:C50" & .Cells(Rows.Count, 3).End(xlUp).Row)
If Not IsEmpty(cell) Then Courses4.AddItem cell.Value
Next cell
End With
With Worksheets("Ranges-Lists")
For Each cell In .Range("C2:C50" & .Cells(Rows.Count, 3).End(xlUp).Row)
If Not IsEmpty(cell) Then Courses5.AddItem cell.Value
Next cell
End With
With Worksheets("Ranges-Lists")
For Each cell In .Range("C2:C50" & .Cells(Rows.Count, 3).End(xlUp).Row)
If Not IsEmpty(cell) Then Courses6.AddItem cell.Value
Next cell
End With
End Sub