|
- Sub 汇总()
- Dim Arr(1 To 1000, 1 To 12), i%, j%, drow%, k%, ddrow%
- i = 1
- Dim sht As Worksheet '定义sht 为工作表
- ' Worksheets("汇总表").Range("a2:p65536").ClearContents
- For Each sht In Worksheets
- ' With sht
- ' MsgBox sht.Name
- If sht.Name <> "汇总表" Then
- With sht
- ' drow = sht.Range("a65536").End(xlUp).Row
- Arr(i, 2) = .Range("d4"): Arr(i, 3) = .Range("n4"): Arr(i, 4) = .Range("d5")
- Arr(i, 5) = .Range("d6"): Arr(i, 6) = .Range("b2"): Arr(i, 7) = .Range("q19"):
- Arr(i, 8) = .Range("q31"): Arr(i, 9) = .Range("q43"): Arr(i, 10) = .Range("q55"):
- Arr(i, 11) = .Range("q67"): Arr(i, 12) = .Range("q72")
- Arr(i, 1) = i
- i = i + 1
- End With
- ' ddrow = Worksheets("汇总").Range("a65531").End(xlUp).Row + 1
- ' MsgBox ddrow
- End If
- ' End With
- Next
- Worksheets("汇总表").Range("a4:l1000").ClearContents
- Worksheets("汇总表").Range("a4").Resize(UBound(Arr, 1), UBound(Arr, 2)) = Arr
- End Sub
复制代码 表格数量不限制。目前看定义的数组量大小,我改成了1000
第三个已经改好了。 |
|