首页 > 其他 > 详细

随便记录下

时间:2020-06-18 16:36:05      阅读:58      评论:0      收藏:0      [点我收藏+]

 

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

 

随便记录下

原文:https://www.cnblogs.com/jianc/p/13158026.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!