Sub loaddata()

    Excel.Application.DisplayAlerts = False
    Excel.Application.ScreenUpdating = False
    
    Dim path, filename, self As String
    Dim mainwb As Workbook
    
    path = Excel.ThisWorkbook.path & "\*.xls"
    
    self = Excel.ActiveWorkbook.Name
    
    Set mainwb = Excel.ActiveWorkbook
    filename = Dir(path)
    Do While filename <> ""
        If filename <> self Then
        
            Dim wb As Excel.Workbook
            Set wb = Excel.Workbooks.Open(Excel.ThisWorkbook.path & "\" & filename)
            
            wb.Sheets.Copy after:=mainwb.Sheets(mainwb.Sheets.Count)
            
            wb.Close
        End If
        filename = Dir
    Loop
    
    
    Excel.Application.DisplayAlerts = True
    Excel.Application.ScreenUpdating = True

End Sub

 

相关文章:

  • 2022-12-23
  • 2021-08-12
  • 2022-01-03
  • 2022-12-23
  • 2022-02-11
  • 2021-05-18
  • 2021-07-09
  • 2022-01-23
猜你喜欢
  • 2022-03-01
  • 2022-01-10
  • 2021-08-09
  • 2021-11-03
  • 2021-09-23
  • 2021-06-02
  • 2021-10-01
相关资源
相似解决方案