|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
jinball 发表于 2014-1-3 16:42
好了,删除条件格式了
使用Excel工作表排序法:- Sub Sheet2()
- Dim arr, brr(1 To 1000, 0 To 10), i&, j&, m&, sh As Worksheet
- Application.ScreenUpdating = False
- Set sh = Sheets("Sheet2")
- sh.Cells.Clear
- With Sheets("Sheet1")
- For i = 1 To Sheets("Sheet1").Range("a" & Rows.Count).End(xlUp).Row Step 10
- m = m + 1
- .Cells(i, 1).Resize(10, 13).Sort Key1:=.Cells(i, 9), Order1:=1, Header:=xlNo
- arr = .Cells(i, 12).Resize(10)
- brr(m, 0) = "I" & i & ":L" & i + 9
- For j = 1 To 10
- brr(m, j) = arr(j, 1)
- .Cells(i + j - 1, 12).Copy
- sh.Cells(m, j + 1).PasteSpecial Paste:=xlPasteFormats
- Next
- Next
- End With
- sh.[a1].Resize(m, 11) = brr
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|