http://zhidao.baidu.com/question/484374074.html
————————————————————————————————————————————————
Sub test()
Dim arr
Dim rs As Range
For Each rs In Selection
arr = Split(rs, ",")
Set js = CreateObject("msscriptcontrol.scriptcontrol")
js.Language = "javascript"
temp = Join(arr, ",")
js.addcode "function aa(bb){js=bb.split(',');js.sort();return js;}"
sortarr = js.eval("aa('" & temp & "')")
Debug.Print sortarr
rs.Value = sortarr
Next
End Sub
经测试符合要求,选中单元格以后执行宏,选中多少单元格执行多少,1楼理解错了,楼主的意思应该是给一个单元格的内容排序
注意,你第5行引号里的逗号为半角,如果你用的是全角把里面改成全角就可以了