跳到主要內容

如何在Excel中將選擇另存為單個文件?

當我們處理一個較長的工作表時,我們可能只想將選定範圍而不是整個工作簿保存為新的Excel文件,例如將不同的工作表選擇發送給不同的人。 我們將介紹在工作表中將選擇保存為單獨的Excel文件的方法。

通過複製和粘貼將選擇另存為單獨的Excel文件

使用VB Macro將選擇另存為單獨的Excel文件

使用Kutools for Excel將選擇另存為單獨的Excel文件


箭頭藍色右氣泡 通過複製和粘貼將選擇保存為單個文件

最常見的方法是將要保存的選擇內容複製為Excel中的單個文件,創建一個新的工作簿,然後將復制的選擇內容粘貼到其上,然後將其保存。

但是,在復制和粘貼過程中,選擇中的某些格式樣式可能會丟失,例如行高等。


箭頭藍色右氣泡 使用VB宏將選擇另存為單個文件

使用宏是一種將選擇保存為單個文件而無需複制並粘貼到新工作簿的簡便方法。

1。 按住 ALT + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。

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的初學者來說,使用Macro可能會有些困難,我們將介紹Kutools for Excel提供的另一種簡便方法。


箭頭藍色右氣泡 使用Kutools for Excel將選擇另存為單個文件

Excel的Kutools's 將範圍導出到文件 工具可以幫助我們方便地將選擇內容快速保存為單個文件。

Excel的Kutools 包括300多個便捷的Excel工具。 30天免費試用,不受限制。 立即獲取.

如果您已經安裝了Kutools for Excel,請按照以下步驟操作:

1。 點擊 企業 > 導入/導出 > 將範圍導出到文件,請參見屏幕截圖:

文檔保存選擇-4

2。 在 將範圍導出到文件 對話框中,單擊 doc-to-csv-6按鈕以選擇要保存為單個文件的範圍,然後選中 Excel工作簿 選項 文件格式 最後,您可以根據需要檢查工作簿選項。

文檔保存選擇-5

3。 點擊 OK,然後會彈出一個 選擇導出範圍的名稱和位置 對話框中,輸入此新文件的名稱,然後選擇一個要將其保存在其中的文件夾。然後單擊“確定”。 節省 按鈕。

筆記:

1。 “ 將範圍導出到文件 Kutools for Excel的工具可以將所有格式保存在選擇中。

2. Kutools for Excel的 將範圍導出到文件 工具可以輕鬆地將日期範圍導出到文件(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選項卡為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