Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save estevecastells/b95b668cec6aec1189c1c1b2dc56ac26 to your computer and use it in GitHub Desktop.
Save estevecastells/b95b668cec6aec1189c1c1b2dc56ac26 to your computer and use it in GitHub Desktop.
Function fncSortStr(strPassed As String) As String
Dim Temp As String
Dim I As Integer
While Len(strPassed)
Temp = Left(strPassed, 1)
For I = 2 To Len(strPassed)
If Mid(strPassed, I, 1) < Temp Then
Temp = Mid(strPassed, I, 1)
End If
Next I
fncSortStr = fncSortStr & Temp
strPassed = Left(strPassed, InStr(1, strPassed, Temp) - 1) & _
Mid(strPassed, InStr(1, strPassed, Temp) + 1)
Wend
End Function
@estevecastells
Copy link
Author

=TRIM(fncSortStr(C2))

@estevecastells
Copy link
Author

=TRIM(clean(fncSortStr(C2)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment