Hi. I can find lots of info on sorting cells but I haven't found the info I'm looking for re sorting *within* cells.
eg. how to sort cell contents such as
(A1) 3814
(A2) dbja
(A3) t7u1
to
(A1) 1348
(A2) abdj
(A3) 17tu
Thanks!
def cell_sort():
oDoc = XSCRIPTCONTEXT.getDocument()
oCell = oDoc.CurrentSelection
oCell.String = ''.join(sorted(oCell.String))
Function SortChars(S$) As String
Dim L%, J%, K%, X$, Y$: L = Len(S)
For J=1 To L-1: X = mid(S, J, 1)
For K=J+1 To L: Y = mid(S, K, 1)
If X>Y Then
mid(S, J, 1) = Y
mid(S, K, 1) = X
X = Y
EndIf
Next
Next
SortChars = S
End Function
Users browsing this forum: Google [Bot] and 10 guests