Skip to main content


Showing posts from November, 2021

Auto split Excel worksheets into files

  In Microsoft Excel, when you want create a new excel file from your current worksheet, just need right-click and select move/copy a sheet. However, if your workbook has many sheets, it take more time. Now, we show you how to save your time by doing that automatically. Create the Visual Basic module Open your excel file. Browse to Developer tab and click View code Click Insert > Module Copy below code into editor Sub SplitWorksheetsIntoFiles() Dim FileExtStr As String Dim FileFormatNum As Long Dim xWs As Worksheet Dim xWb As Workbook Dim xNWb As Workbook Dim FolderName As String Application.ScreenUpdating = False Set xWb = Application.ThisWorkbook DateString = Format(Now, "yyyymmdd-hhmmss") FolderName = xWb.Path & "\" & xWb.Name & "+" & DateString If Val(Application.Version) < 12 Then FileExtStr = ".xls": FileFormatNum = -4143 Else Select Case xWb.FileFormat Case 51: FileExtStr = ".