I am having some Userform issues. I have 4 comboboxes on my userform. All are getting results from the previous combobox. 3 of them work, but I don't know how to get the last combobox to work. Also, I have a Frame with 2 optionbuttons but I cannot figure out the VBA code to write the optionbutton results to my spreadsheet. The comproduct, combescription, comcabinet, work, but not comchoose work. Below is some of my code:
Code:
Private Sub comdescription_Change()
Dim ceDes As Range: Dim wsDV As Worksheet
comcabinet.Value = ""
If comcabinet.ListCount >= 1 Then
For n = 0 To comcabinet.ListCount - 1
comcabinet.RemoveItem (0)
Next n
End If
Set wsDV = Worksheets("DataValidation")
Set ceDes = wsDV.Range("2027:2027").Find(comdescription.Text)
r = 2027 + 1
If Not ceDes Is Nothing Then
Do Until wsDV.Cells(r, ceDes.Column) = ""
comcabinet.AddItem wsDV.Cells(r, ceDes.Column)
r = r + 1
Loop
End If
End Sub
Private Sub comproduct_Change() ' Door Style ComboBox
'comproduct.RowSource = Sheets("DataValidation").Range("c2:c") & v
Dim cePdt As Range: Dim wsDV As Worksheet
comdescription.Value = ""
If comdescription.ListCount >= 1 Then
For n = 0 To comdescription.ListCount - 1
comdescription.RemoveItem (0)
Next n
End If
Set wsDV = Worksheets("DataValidation")
Set cePdt = wsDV.Range("2003:2003").Find(comproduct.Text)
r = 2003 + 1
If Not cePdt Is Nothing Then
Do Until wsDV.Cells(r, cePdt.Column) = ""
comdescription.AddItem wsDV.Cells(r, cePdt.Column)
r = r + 1
Loop
End If
End Sub
Private Sub comcabinet_Change()
Dim ceCab As Range: Dim wsDV As Worksheet
comchoose.Value = ""
If comchoose.ListCount >= 1 Then
For n = 0 To comchoose.ListCount - 1
comchoose.RemoveItem (0)
Next n
End If
Set wsDV = Worksheets("DataValidation")
Set ceCab = wsDV.Range("2038:2038").Find(comcabinet.Text)
r = 2038 + 1
End Sub
Private Sub cmdenter_Click()
ActiveWorkbook.Sheets("DataGatheringAllocation").Activate
Range("c9").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = comproduct.Value
ActiveCell.Offset(0, 1) = comdescription.Value
ActiveCell.Offset(0, 2) = comcabinet.Value
ActiveCell.Offset(0, 3) = comchoose.Value
' ActiveCell.Offset(0, 4) =
ActiveCell.Offset(0, 9) = txtPurPr.Value
ActiveCell.Offset(0, 10) = txtSupCp.Value
ActiveCell.Offset(0, 19) = comwarehouse.Value
ActiveCell.Offset(0, 20) = comwcustomer.Value
Me.comproduct.Value = ""
Me.comdescription.Value = ""
Me.comcabinet.Value = ""
Me.comchoose.Value = ""
' Me.Hinging.Value = ""
Me.txtPurPr.Value = ""
Me.txtSupCp.Value = ""
Me.comwarehouse.Value = ""
Me.comwcustomer.Value = ""
Me.comproduct.SetFocus
End Sub