|
- Option Explicit
- Sub 按钮1_Click()
- Dim arr
- Dim sh As Worksheet
- Dim x, y As Integer
- For Each sh In Sheets
- If sh.Name = "表1" Or sh.Name = "表2" Then
- x = sh.Cells.Find("*", [a1], , , , xlPrevious).Row '查找表已使用的最后一行号
- With Sheets("原汇总")
- y = .Range("a100000").End(xlUp).Row '查找汇总最后一行行号
- Rows(y - 1 & ":" & y + x - 2).Insert '插入与已使用行数一样的行,使用两个说明后置
- sh.Range("a1:b" & x).Copy .Range("a" & y - 1) '粘贴
- End With
- End If
- Next
- End Sub
复制代码 |
|