Skip to main content

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.

Save selections as individual Excel files with copying and pasting

Save selections as individual Excel files with VB Macro

Save Selections as individual Excel files with Kutools for Excel


arrow blue right bubble Save selections as individual files with copying and pasting

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.


arrow blue right bubble Save selections as individual files with VB Macro

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:

doc-save-selection-1

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:

doc-save-selection-2

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.


arrow blue right bubble Save Selections as individual files 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:

doc-save-selection-4

2. In the Export Range to File dialog box, click the doc-data-to-csv-6button 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.

doc-save-selection-5

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.

Notes:

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.


arrow blue right bubbleRelated Articles

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

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...

Description


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!
Comments (6)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi,


Liked the VBA option. Is there a way to retain formulas in new file? The data in new file is automatically pasted s 'values' and does not have the formulas.
This comment was minimized by the moderator on the site
Do you know how I can do this on a default custom template? I have a lot of data in one book/sheet that I have to save only a selection to a new file. Option 2 works great. But, I need to have some information on the top for each new file I make (Copying and pasting is very tedious so I am looking for a quicker and more effective option). So would it be possible to first use the file with lots of data and select certain cells to save ON the default custom template I made, specifically underneath the header of the default template (the template is integrated into Excel to automatically open when I open Excel). Please help, thanks!!
This comment was minimized by the moderator on the site
i have tried different things to make it copy+paste value, i dont know where i go wrong. How do i change the VBA: export range to Excel file to just copy paste value? TIA
This comment was minimized by the moderator on the site
This VB macro is great! However, I was wondering if there was a way to keep the source formatting when the selected range gets saved to a new workbook. Thanks!
This comment was minimized by the moderator on the site
Hi, I am use the above VB macro, and works great. The only thing is that the range i select has a results from a formula and when i open the text file i get #REF. Could you please help out. cheer
This comment was minimized by the moderator on the site
Double click on #REF cell and will get it right
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations