excel合并sheet内容
右键新建的sheet页名称,选择查看代码,复制以下代码,F5或者点击菜单中运行
Sub hb()
Dim bt, i, r, c, n, first As Long
bt = 1 '表头行数,多行改为对应数值
Cells.Clear
For i = 1 To Sheets.Count
If Sheets(i).Name <> ActiveSheet.Name Then
If first = 0 Then
c = Sheets(i).Cells(1, Columns.Count).End(xlToLeft).Column
Sheets(i).Range("A1").Resize(bt, c).Copy Range("A1")
n = bt + 1: first = 1
End If
r = Sheets(i).Cells(Rows.Count, "A").End(xlUp).Row
Sheets(i).Range("A" & bt + 1).Resize(r - 1, c).Copy Range("A" & n)
n = n + r - bt
End If
Next
End Sub