如何把多个EXCEL表格里的内容都合并在一个表格里
展开全部
Sub s()
Dim pth$, fn$, wb As Workbook, tsh As Worksheet, sh As Worksheet, n&
pth = "D:\Temp\" '在此输入完整路径
fn = Dir(pth & "*.xls")
Set tsh = ActiveSheet
Do While fn <> ""
Set wb = Application.Workbooks.Open(pth & fn)
For Each sh In wb.Sheets
n = tsh.UsedRange.Row + tsh.UsedRange.Rows.Count
sh.UsedRange.Copy tsh.Cells(n, 1)
Next
wb.Close False
fn = Dir
Loop
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询