Author: Oscar Cronquist Article last updated on February 20, 2018

The following macro lets you select a cell range and a delimiting character. The macro sorts the values in each cell using the delimiting character.

VBA Code

Sub SortValuesInCell()
Dim rng As Range
Dim cell As Range
Dim del As String
Dim Arr As Variant

On Error Resume Next
Set rng = Application.InputBox(Prompt:="Select a cell range:", _
Title:="Sort values in a single cell", _
Default:=Selection.Address, Type:=8)
del = InputBox(Prompt:="Delimiting character:", _
Title:="Sort values in a single cell", _
On Error GoTo 0

For Each cell In rng
    Arr = Split(cell, del)
    SelectionSort Arr
    cell = Join(Arr, del)
Next cell

End Sub

I used the "Sort array" function found here:
Using a Visual Basic Macro to Sort Arrays in Microsoft Excel (microsoft)
with some small modifications. Remember, you can´t undo the changes the macro does to your spreadsheet.

Download excel *.xlsm file

Sort values in a cell.xlsm