Hello,
I would consider myself very new to visual basic, but after a lot of research, I have been unable to find an answer to my question. I have been able to watch some youtube videos of cascading comboboxes, but I havent been able to find one that explained how to have 4 conditional boxes. I figure that there is an and statement that needs to be thrown in there, but I am just not sure on how to do it. Any help would be appreciated, and if you would prefer a different type of example attached I can provide that.
Thank you very much.
My code is
Private Sub ComboBoxConnectionBrand_LostFocus()
Dim csheet As Worksheet
Set csheet = ThisWorkbook.Sheets("connections")
Me.ComboBoxSize.Clear
Me.ComboBoxWeight.Clear
Me.ComboBoxConnection.Clear
For Each cell In ThisWorkbook.Sheets("connections").Range("brand")
If Me.ComboBoxConnectionBrand = cell Then
Me.ComboBoxSize.AddItem cell.Offset(0, 1)
End If
Next cell
Me.ComboBoxSize = ""
End Sub
Private Sub comboboxsize_lostfocus()
Dim csheet As Worksheet
Set csheet = ThisWorkbook.Sheets("connections")
Dim ConnBrand As String
ConnBrand = Me.ComboBoxConnectionBrand.Value
Me.ComboBoxWeight.Clear
Me.ComboBoxConnection.Clear
For Each cell In ThisWorkbook.Sheets("connections").Range("size")
If Me.ComboBoxSize = cell Then
Me.ComboBoxWeight.AddItem cell.Offset(0, 1)
End If
Next cell
Me.ComboBoxWeight = ""
End Sub
Private Sub comboboxweight_lostfocus()
Dim csheet As Worksheet
Set csheet = ThisWorkbook.Sheets("connections")
Me.ComboBoxConnection.Clear
For Each cell In ThisWorkbook.Sheets("connections").Range("weight")
If Me.ComboBoxWeight = cell Then
Me.ComboBoxConnection.AddItem cell.Offset(0, 1)
End If
Next cell
Me.ComboBoxConnection = ""
End Sub
Bookmarks