Excel Sort Function.
Link
-----
This one is simple but not perfect function since two rows could have the same value.
It can be differentiated by adding cell.Value&(10^-9*ROW()).
Function Sortme(miRango As Range, Optional ByVal Order As Integer) As String
If Order = 0 Then Order = 1
For Each cell In miRango
temp1 = Application.WorksheetFunction.CountIf(miRango, "<=" & cell.Value)
If Order = temp1 Then Exit For
Next cell
Sortme = cell.Value
End Function
Reference: Link
Link
-----
This one is simple but not perfect function since two rows could have the same value.
It can be differentiated by adding cell.Value&(10^-9*ROW()).
Function Sortme(miRango As Range, Optional ByVal Order As Integer) As String
If Order = 0 Then Order = 1
For Each cell In miRango
temp1 = Application.WorksheetFunction.CountIf(miRango, "<=" & cell.Value)
If Order = temp1 Then Exit For
Next cell
Sortme = cell.Value
End Function
Reference: Link