<font face=Courier New><SPAN style="color:#00007F">Function</SPAN> SortCell(myR <SPAN style="color:#00007F">As</SPAN> Range, OrdAsc <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Boolean</SPAN>) <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN><br><SPAN style="color:#00007F">Dim</SPAN> myArr() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN><br><SPAN style="color:#00007F">Dim</SPAN> myTemp <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Variant</SPAN><br><SPAN style="color:#00007F">Dim</SPAN> i <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN><br><SPAN style="color:#00007F">Dim</SPAN> j As <SPAN style="color:#00007F">Integer</SPAN><br><br><SPAN style="color:#007F00">'Split the string into characters</SPAN><br><SPAN style="color:#00007F">ReDim</SPAN> myArr(1 <SPAN style="color:#00007F">To</SPAN> Len(myR.Value))<br><SPAN style="color:#00007F">For</SPAN> i = 1 <SPAN style="color:#00007F">To</SPAN> Len(myR.Value)<br>myArr(i) = Mid(myR.Value, i, 1)<br><SPAN style="color:#00007F">Next</SPAN> i<br><SPAN style="color:#007F00">'Do the sort</SPAN><br><SPAN style="color:#00007F">For</SPAN> i = <SPAN style="color:#00007F">LBound</SPAN>(myArr) <SPAN style="color:#00007F">To</SPAN> <SPAN style="color:#00007F">UBound</SPAN>(myArr) - 1<br><SPAN style="color:#00007F">For</SPAN> j = i + 1 <SPAN style="color:#00007F">To</SPAN> <SPAN style="color:#00007F">UBound</SPAN>(myArr)<br><SPAN style="color:#00007F">If</SPAN> Ascending <SPAN style="color:#00007F">Then</SPAN><br><SPAN style="color:#00007F">If</SPAN> myArr(i) > myArr(j) <SPAN style="color:#00007F">Then</SPAN><br>myTemp = myArr(j)<br>myArr(j) = myArr(i)<br>myArr(i) = myTemp<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br><SPAN style="color:#00007F">Else</SPAN><br><SPAN style="color:#00007F">If</SPAN> myArr(i) < myArr(j) <SPAN style="color:#00007F">Then</SPAN><br>myTemp = myArr(j)<br>myArr(j) = myArr(i)<br>myArr(i) = myTemp<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br><SPAN style="color:#00007F">Next</SPAN> j<br><SPAN style="color:#00007F">Next</SPAN> i<br><br><SPAN style="color:#007F00">'Return the sorted string</SPAN><br><br>SortCell = Join(myArr, "")<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Function</SPAN></FONT>