|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
jinball 发表于 2014-1-2 16:35
就是这个里面的Sheet3中的效果,再麻烦您了! - Sub Macro1()
- Dim arr, brr(1 To 1000, 0 To 10), i&, j&, m&, sh As Worksheet
- Set sh = Sheets("Sheet3")
- 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
- End Sub
复制代码 |
|