Thanks snb !
I wrote this one, but this doesn't return duplicates. At the time of writing this code, I haven't thought of duplicates
Code:Function SortArray(ByVal SortedArray As Variant, ByVal Array2Sort As Variant) As Variant Dim Order(), x, i As Long Const Delim As String = "|" ReDim Order(UBound(SortedArray)) For i = LBound(SortedArray) To UBound(SortedArray) Order(i) = Delim Next For i = LBound(Array2Sort) To UBound(Array2Sort) x = Application.Match(Array2Sort(i), SortedArray, 0) If Not IsError(x) Then Order(x - 1) = Array2Sort(i) End If Next SortArray = Filter(Order, Delim, False) End Function





Reply With Quote
Bookmarks