Can be done with a user defined function.
Function SortWithinCell(CelltoSort As Range, DelimitingCharacter As String, IncludeSpaces As Boolean) As String
CelltoSortString = WorksheetFunction.Substitute(CelltoSort.Value, " ", "")
MyArray = Split(CelltoSortString, DelimitingCharacter)
For N = 0 To UBound(MyArray)
For M = 1 To UBound(MyArray)
If MyArray(M) < MyArray(M - 1) Then
TempValue = MyArray(M)
MyArray(M) = MyArray(M - 1)
MyArray(M - 1) = TempValue
End If
Next M
Next N
For N = 0 To UBound(MyArray)
SortWithinCell = SortWithinCell & MyArray(N) & DelimitingCharacter
Next N
SortWithinCell = Left(SortWithinCell, Len(SortWithinCell) - 1)
If IncludeSpaces = True Then SortWithinCell = WorksheetFunction.Substitute(SortWithinCell, ",", ", ")
End Function
Alt F11 to open the VBA editor. Insert - module. Paste in the above. Alt F11 back to worksheet,
In B1 enter
=SortWithinCell(A1,",",TRUE)
assuming starting string is in A1
Way above my head, would you mind dumbing it down just a bit? I really appreciate your help.
Bookmarks