|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
你可是 08年 就注册论坛了!这么浅显的 也看不出来!我真服了!!!!请测试如下代码吧》》》》》》》》》》》》》》》》》- Sub main()
- Dim arr, brr(), s$, kr, r&
- r = Range("a:k").Find("*", , , , 1, 2).Row
- Range("n:x").Clear: arr = Range("a1:k" & r)
- ReDim brr(1 To r, 1 To UBound(arr, 2))
- For i = 1 To r
- s = Empty
- For j = 1 To UBound(arr, 2)
- If Len(arr(i, j)) Then s = s & "," & "'" & arr(i, j) & "'"
- Next
- If s <> Empty Then
- kr = Split(mySort(s), ",")
- For j = 0 To UBound(kr)
- brr(i, j + 1) = kr(j)
- Next
- End If
- Next
- Range("n1").Resize(r, UBound(arr, 2)) = brr
- End Sub
- Function mySort(ByVal s As String) As String
- Dim js As Object, i&, D As Object
- Set D = CreateObject("htmlfile"): Set js = D.parentWindow
- js.execScript "o={};b=" & "[" & Mid(s, 2) & "]" & ";for(i=0;i<b.length;i++)o[b[i]]=0;"
- js.execScript "a=[];j=0;for(k in o)a.push(k);a.sort(function (x,y){return x-y});"
- mySort = js.eval("a")
- End Function
复制代码
|
评分
-
2
查看全部评分
-
|