|

楼主 |
发表于 2012-5-25 14:55
|
显示全部楼层
问题已经解决 现在发吧一下正确答案 飞天小猪给的
Sub aa()
j = Sheet1.[b65536].End(xlUp).Row - 2 '从哪个表取数,就把sheet1改成那个表的表名
i = 3
With Sheet1 '从哪个表取数,就把sheet1改成那个表的表名
Do While i < j * 5 + 2
For k = 3 To j + 2
Cells(i, 1) = .Cells(2, 1)
Cells(i, 2) = .Cells(k, 1)
Cells(i, 3) = .Cells(2, 3)
Cells(i, 4) = .Cells(k, 3)
Cells(i + 1, 1) = .Cells(2, 4)
Cells(i + 1, 2) = .Cells(k, 4)
Cells(i + 1, 3) = .Cells(2, 5)
Cells(i + 1, 4) = .Cells(k, 5)
Cells(i + 2, 1) = .Cells(2, 6)
Cells(i + 2, 2) = .Cells(k, 6)
Cells(i + 2, 3) = .Cells(2, 2)
Cells(i + 2, 4) = .Cells(k, 2)
Cells(i + 3, 1) = .Cells(2, 7)
Cells(i + 3, 2) = .Cells(k, 7)
Cells(i + 3, 3) = .Cells(2, 9)
Cells(i + 3, 4) = .Cells(k, 9)
i = i + 5
Next
Loop
End With
End Sub
新建一个宏就可以了 |
|