美文网首页
excel按sheet将表格拆分成独立表格

excel按sheet将表格拆分成独立表格

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

    sheet表转独立的表格

    方案一:

    已测试有效,拆分表格到当前文件夹中

    Sub sheet转独立文件()
    Dim sht As Worksheet
    Application.ScreenUpdating = False
    ipath = ThisWorkbook.Path &"\"
    For Each sht In Sheets
    sht.Copy
    ActiveWorkbook.SaveAs ipath & sht.Name
    ActiveWorkbook.Close
    Next
    Application.ScreenUpdating = True
    End Sub
    

    方案二:

    拆分表格到3月文件夹下

    Sub 拆分表格()  
        Dim x As Integer  
        Dim wb As Workbook  
        Application.ScreenUpdating = False  
        For x = 2 To 32    
            Sheets(x).Copy    
            Set wb = ActiveWorkbook    
            With wb     
            .SaveAs ThisWorkbook.Path & "/3月/" & Sheets(x).Name & ".xlsx"     
            .Close True    
            End With  
        Next x  
        Application.ScreenUpdating = True 
    End Sub
    

    相关文章

      网友评论

          本文标题:excel按sheet将表格拆分成独立表格

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