excel拆子表格成单独的文件

显示excel开发工具

选项->自定义功能区->开发工具打勾

Visual Basic

点击 Visual Basic,双击This workbook,输入代码

Sub 拆分()
    Dim i
    Dim sht As Worksheet
    Application.DisplayAlerts = False
    For Each sht In Sheets
        sht.Copy
        i = ThisWorkbook.Path & "\" & sht.Name & ".xlsx"
        ActiveWorkbook.SaveAs i
        ActiveWorkbook.Close
    Next
    Application.DisplayAlerts = True
    MsgBox "完成", vbOKOnly, "示"
End Sub

点击中间考下的绿色三角符号,“运行”。提示完成,即完成

你可能感兴趣的:(excel拆子表格成单独的文件)