Thread: Duplicates?
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Duplicates?

Couldn't you use the click event to test it?

Private Sub ComboBox1_Change()
CheckValue ComboBox1
End Sub

Private Sub ComboBox2_Change()
CheckValue ComboBox2
End Sub

Sub CheckValue(Combo As MSForms.ComboBox)
Dim oCtl As Control

For Each oCtl In Me.Controls
If TypeName(oCtl) = "ComboBox" Then
If oCtl.Name < Combo.Name Then
If oCtl.ListIndex < -1 Then
If Combo.Value = oCtl.Value Then
MsgBox "Duplicate"
oCtl.ListIndex = -1
End If
End If
End If
End If
Next oCtl
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"browie" wrote in message
...
Hi all
I have a userform with 8 combobox's and I have them all linked to the same
row sources. How can I stop the user from selecting a same value as

another
combobox in this group

Thanks in advance