I have a user form where the user must type in a new value into the combobox control on the form. I want to be able to validate the entry to make sure it doesn't already exist in the list. There is a add button that adds the new value to the list
So I'm trying to add code behind the 'add' button to compare the entry made by the user to the values already in the combo box list. However I'm unsure how to extract the values in the list from the combo box and then compare those values to the value the user entered in the combo box. The following code is started but I don't know the syntax to get the values from the list to compare:
For Each cCatg In ws.Range("CategoryList")
With Me.cboCatgList
If Trim(Me.cboCatgList.Value) = *** what do I put here **** Then
Me.cboCatgList.SetFocus
MsgBox "This value already exists"
Exit Sub
End If
End With
Next cCatg
So I'm trying to add code behind the 'add' button to compare the entry made by the user to the values already in the combo box list. However I'm unsure how to extract the values in the list from the combo box and then compare those values to the value the user entered in the combo box. The following code is started but I don't know the syntax to get the values from the list to compare:
For Each cCatg In ws.Range("CategoryList")
With Me.cboCatgList
If Trim(Me.cboCatgList.Value) = *** what do I put here **** Then
Me.cboCatgList.SetFocus
MsgBox "This value already exists"
Exit Sub
End If
End With
Next cCatg