How to save a selection as individual file in Excel?
When we deal with a long worksheet, we may want to save only a selected range instead of a whole workbook as a new Excel file, such as sending different selections of a worksheet to different persons. We will introduce methods to save selections in a worksheet as individual Excel files.
The most common method is to copy the selection that you want to save as an individual file in Excel, create a new workbook, and paste the copied selection on it, then save it.
However, you may lose some format styles in the selection during copying and pasting, such as row height, etc.
Using Macro is an easy way to save the selections as individual files without copying and pasting to a new workbook.
1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
2. Click Insert > Moudle, and paste the following code into the Moudle Window.
VBA: export range to Excel file
Sub ExportRangetoExcel() 'Update 20130916 Dim wb As Workbook Dim saveFile As String Dim WorkRng As Range Dim address As String Dim defult As Integer On Error Resume Next xTitleId = "KutoolsforExcel" Set WorkRng = Application.Selection Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.address, Type:=8) Application.ScreenUpdating = False Application.DisplayAlerts = False defult = Application.SheetsInNewWorkbook Application.SheetsInNewWorkbook = 1 Set wb = Application.Workbooks.Add Application.SheetsInNewWorkbook = defult WorkRng.Copy wb.Worksheets(1).Paste address = Replace(WorkRng.address, ":", "-") address = Replace(address, "$", "") address = Replace(address, ".", "") saveFile = Application.GetSaveAsFilename(InitialFileName:=address, fileFilter:="Excel Workbooks (*.xlsx),*.xlsx") wb.SaveAs Filename:=saveFile wb.Close Application.CutCopyMode = False Application.DisplayAlerts = True Application.ScreenUpdating = True End Sub
3. Then press F5 key to execute the operation, and a prompt box will pop out to remind you select a range that you want to save as individual Excel file. See screenshot:
4. Then click OK, and specify a folder to locate this new file and then enter a name for your file in the Save As dialog box, see screenshot:
5. And then click Save button, the selected range has been saved as a new Excel workbook.
Using Macro may be a little hard for starter of Microsoft Excel, and we will introduce another easy and convenient way provided with Kutools for Excel.
Kutools for Excel's Export Range to File tool can help us conveniently save selections as individual files quickly.
Kutools for Excel includes more than 300 handy Excel tools. Free to try with no limitation in 30 days. Get it Now.
If you have installed Kutools for Excel, please do as this:
1. Click Enterprise > Import / Export > Export Range to File, see screenshot:
2. In the Export Range to File dialog box, click the button to select the range that you want to save it as an individual file, and then check Excel workbook option in File format section, at last, you can check the workbook options as you need.
3. Click OK, then it will pop up a Select a name and location for the exported range dialog box, enter a name for this new file, and select a folder where you will save it in. And then click Save button.
1. The Export Range to File tool of Kutools for Excel can save all formatting in the selections.
2. Kutools for Excel's Export Range to File tool makes it possible to easily export a range of date to a file, either an Excel workbook, a CSV, a simple HTML or all formatting HTML.
3. If you check Open the file after export option in the dialog box, the new file will be launched automatically after exporting it successfully.
To know more about this feature, please click Export Range to File.
- Export Excel data as HTML
- Save selection or entire workbook as PDF
- Export Excel data to CSV files in Excel
- Export Excel data to Text files in Excel
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!