美文网首页
多个excel文件合并到一个excel表格中

多个excel文件合并到一个excel表格中

作者: 百试成神 | 来源:发表于2020-03-09 11:52 被阅读0次

本程序可实现把当前目录下---3月--文件夹下的所有xls文件剪切并合>并的当前excel,变成sheet表

代码:

Sub 合并表格()
 Dim mypath As String
 Dim f As String
 Dim ribao As Workbook
 Application.ScreenUpdating = False
 mypath = ThisWorkbook.Path & "/3月/"
 f = Dir(ThisWorkbook.Path & "/3月/*.xls")
 Do
   Workbooks.Open (mypath & f)
   With ActiveWorkbook
     .Sheets(1).Move after:=ThisWorkbook.Sheets(Sheets.Count)
   End With
   f = Dir
 Loop Until Len(f) = 0
 Application.ScreenUpdating = True
End Sub

相关文章

网友评论

      本文标题:多个excel文件合并到一个excel表格中

      本文链接:https://www.haomeiwen.com/subject/eywudhtx.html