|
本帖最后由 bluexuemei 于 2014-9-30 10:51 编辑
- Sub t()
- '需要安装ACTIVERUBY ,下载地址 http://www.artonx.org/data/asr/Ruby-2.1.1.msi
- Set ojs = CreateObject("scriptcontrol"): ojs.Language = "rubyscript"
- ojs.eval ("def aa(aa,bb);$aa=aa;$bb=bb.flatten;end")
- y = ojs.Run("aa", Sheet1.Range("A2", Sheet1.[c2].End(4)).Value, Sheet2.[b1:b3].Value)
- y = ojs.eval("$aa.sort_by{|x|[$bb.index(x[0]),x[1]]}")
- Sheet1.[a2].Resize(UBound(y) + 1, UBound(y, 2) + 1) = y
- Set ojs = Nothing
- 'Stop
- End Sub
复制代码 按C列数字大小排- Sub t()
- '需要安装ACTIVERUBY ,下载地址 http://www.artonx.org/data/asr/Ruby-2.1.1.msi
- Set ojs = CreateObject("scriptcontrol"): ojs.Language = "rubyscript"
- ojs.eval ("def aa(aa,bb);$aa=aa;$bb=bb.flatten;end")
- y = ojs.Run("aa", Sheet4.Range("A2", Sheet4.[c2].End(4)).Value, Sheet2.[b1:b3].Value)
- y = ojs.eval("$aa.sort_by{|x|[$bb.index(x[0]),x[2]]}")
- Sheet1.[a2].Resize(UBound(y) + 1, UBound(y, 2) + 1) = y
- Set ojs = Nothing
- 'Stop
- End Sub
复制代码 |
|