跳到主要内容

如何在Excel中将选择另存为单个文件?

当处理较长的工作表时,我们可能只想将选定范围而不是整个工作簿保存为新的Excel文件,例如将不同的工作表选择发送给不同的人。 我们将介绍在工作表中将选择保存为单独的Excel文件的方法。

通过复制和粘贴将选择另存为单独的Excel文件

使用VB Macro将选择另存为单独的Excel文件

使用 Kutools for Excel 将选择保存为单独的 Excel 文件


箭头蓝色右气泡 通过复制和粘贴将选择保存为单个文件

最常见的方法是将要保存的选择内容复制为Excel中的单个文件,创建一个新的工作簿,然后将复制的选择内容粘贴到其上,然后将其保存。

但是,在复制和粘贴过程中,选择中的某些格式样式可能会丢失,例如行高等。


箭头蓝色右气泡 使用VB宏将选择另存为单个文件

使用宏是一种将选择保存为单个文件而无需复制并粘贴到新工作簿的简便方法。

1。 按住 ALT + F11 键打开 Microsoft Visual Basic应用程序 窗口。

2。 点击 插页 > Moudle,然后将以下代码粘贴到Moudle窗口中。

VBA:将范围导出到Excel文件

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。 然后按 F5 键执行该操作,将弹出提示框,提醒您选择要另存为单个Excel文件的范围。 看截图:

文档保存选择-1

4。 然后点击 OK,并指定一个文件夹来查找此新文件,然后在 另存为 对话框,请参见屏幕截图:

文档保存选择-2

5。 然后点击 保存 按钮,所选范围已另存为新的Excel工作簿。

对于 Microsoft Excel 的初学者来说,使用宏可能有点困难,我们将介绍 Kutools for Excel 提供的另一种简单方便的方法。


箭头蓝色右气泡 使用 Kutools for Excel 将选择保存为单独的文件

Kutools for Excel's 将范围导出到文件 工具可以帮助我们方便地将选择内容快速保存为单个文件。

Kutools for Excel 包括300多个便捷的Excel工具。 30天免费试用,不受限制。 立即获取.

如果您已经安装了 Kutools for Excel,请按照以下步骤操作:

1。 点击 企业 > 导入/导出 > 将范围导出到文件,请参见屏幕截图:

文档保存选择-4

2。 在 将范围导出到文件 对话框中,单击 doc-to-csv-6按钮以选择要保存为单个文件的范围,然后选中 Excel工作簿 选项 文件格式 最后,您可以根据需要检查工作簿选项。

文档保存选择-5

3。 点击 OK,然后会弹出一个 选择导出范围的名称和位置 对话框中,输入此新文件的名称,然后选择一个要将其保存在其中的文件夹。然后单击“确定”。 保存 按钮。

:

1. 将范围导出到文件 Kutools for Excel 工具可以保存选择中的所有格式。

2.Excel的Kutools 将范围导出到文件 工具可以轻松地将日期范围导出到文件(Excel工作簿,CSV,简单HTML或所有格式的HTML)。

3.如果您检查 导出后打开文件 对话框中的“选项”,成功导出新文件后,它将自动启动。

要了解有关此功能的更多信息,请单击 将范围导出到文件.


箭头蓝色右气泡相关文章

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
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