|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
请测试》》》》》》》》》》》》》》》- Sub main()
- Dim a, b(), s$, js As Object
- r = Cells(Rows.Count, "i").End(3).Row
- a = Range("i5:i" & r): ReDim b(1 To r - 4, 1 To 1)
- Set js = CreateObject("MSScriptControl.ScriptControl")
- js.Language = "JavaScript"
- For i = 1 To r - 4
- If Len(a(i, 1)) Then
- s = "[" & a(i, 1) & "]"
- b(i, 1) = js.eval("a=" & s & ";b=[];for(i=0;i<a.length;i++)b.push(i+1);b.sort(function(x,y){return a[y-1]-a[x-1]});")
- End If
- Next
- Range("b5:b" & r) = b
- End Sub
复制代码
|
|