Function existsame(ByRef x As Variant) As Integer
existsame = 0
On Error Resume Next
Dim i As Long, temp As New Collection
For i = 0 To UBound(x)
temp.Add x(i), x(i)
If temp.Count <= i Then
existsame = 1
Exit Function
End If
Next
End Function
Private Sub Command1_Click()
Dim x
x = Array("ab", "bc", "ac", "ab", "sr", "ac", "ad")
MsgBox existsame(x)
End Sub
Function existsame(ByRef x As Variant) As Integer
existsame = 0
Dim i As Long
For i = 0 To UBound(x)
If UBound(Filter(x, x(i), , vbBinaryCompare)) > 0 Then
existsame = 1
Exit Function
End If
Next
End Function
Function existsame(ByRef x As Variant) As Boolean
Dim i As Long
For i = 0 To UBound(x)
If UBound(Filter(x, x(i), , vbBinaryCompare)) > 0 Then
existsame = True
Exit Function
End If
Next
End Function