Function Unique2DArray(ByVal sArray, ByVal ColIndex As Long, ByVal HasTitle As Boolean)
Dim TmpArr, KeyArr, Tmp, i As Long, j As Long, Arr
On Error Resume Next
TmpArr = sArray
ColIndex = ColIndex + LBound(TmpArr, 2) - 1
With CreateObject("Scripting.Dictionary")
For i = LBound(TmpArr, 1) - HasTitle To UBound(TmpArr, 1)
Tmp = TmpArr(i, ColIndex)
If Not .Exists(Tmp) And Tmp <> "" Then .Add Tmp, i
Next
If .Count Then
KeyArr = .Keys
ReDim Arr(LBound(KeyArr) + LBound(TmpArr, 1) To UBound(KeyArr) - HasTitle + LBound(TmpArr, 1), LBound(TmpArr, 2) To UBound(TmpArr, 2))
For i = LBound(KeyArr) To UBound(KeyArr)
For j = LBound(TmpArr, 2) To UBound(TmpArr, 2)
Arr(i - HasTitle + LBound(TmpArr, 1), j) = TmpArr(.Item(KeyArr(i)), j)
Next
Next
If HasTitle Then
For j = LBound(TmpArr, 2) To UBound(TmpArr, 2)
Arr(LBound(TmpArr, 1), j) = TmpArr(LBound(TmpArr, 1), j)
Next
End If
Unique2DArray = Arr
End If
End With
End Function