Sub SplitSort()
Dim Lst As Object
Dim Elm As Variant
Dim cl As Range
Set Lst = CreateObject("system.collections.arraylist")
For Each cl In Range("A2", Range("A" & Rows.Count).End(xlUp))
For Each Elm In Split(cl, ";")
Lst.add Elm
Next Elm
Lst.Sort
cl = Join(Lst.toarray, Chr(10))
Lst.Clear
Next cl
End Sub
How aboutCode:Sub SplitSort() Dim Lst As Object Dim Elm As Variant Dim cl As Range Set Lst = CreateObject("system.collections.arraylist") For Each cl In Range("A2", Range("A" & Rows.Count).End(xlUp)) For Each Elm In Split(cl, ";") Lst.add Elm Next Elm Lst.Sort cl = Join(Lst.toarray, Chr(10)) Lst.Clear Next cl End Sub
Sub SplitSort()
Dim Lst As Object
Dim Elm As Variant
Dim cl As Range
Set Lst = CreateObject("system.collections.arraylist")
For Each cl In Range("C2:E52")
For Each Elm In Split(cl, ";")
Lst.add Elm
Next Elm
Lst.Sort
cl = Join(Lst.toarray, Chr(10))
Lst.Clear
Next cl
End Sub
Excel 2013/2016 | |||||
---|---|---|---|---|---|
A | B | C | |||
1 | Before | After | |||
2 | economic burden;epidemilogy;survival;quality of life | economic burden epidemilogy quality of life survival | |||
3 | disease;genetics;lung cancers;sclc;mutated genes | disease genetics lung cancers mutated genes sclc | |||
Sheet2 |