Skip to content

Instantly share code, notes, and snippets.

@thoriqmacto
Created January 13, 2021 07:43
Show Gist options
  • Save thoriqmacto/d054059e6195bafc0d3139a9a5dde85e to your computer and use it in GitHub Desktop.
Save thoriqmacto/d054059e6195bafc0d3139a9a5dde85e to your computer and use it in GitHub Desktop.
[VBA] Boolean function to return whether a 1D-array members is unique or not.
Public Function IsArrayUnique(tArr As Variant) As Boolean
Dim out As Boolean, tOut As Double
Dim i As Long
For Each t In tArr
If Len(t) > 0 Then
tOut = WorksheetFunction.Match(CStr(t), tArr, 0)
If WorksheetFunction.IsError(tOut) Then
out = False
Else
out = True
End If
End If
Next t
IsArrayUnique = out
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment