Sometimes you may want to save only one worksheet in one workbook, actually there are two ways to implement this. The first one, you can remove the others from current workbook, you must confirm that these worksheets are useless before removing. The second one, you can copy current worksheet to another new workbook, then only one single worksheet exists in the new workbook. This article will introduce you two ways to save only one single worksheet in one workbook based on above two methods. Please read article below and get the details.
Table of Contents
1. Save One Single Worksheet in New Workbook by Move or Copy Function
Create a workbook with some worksheets. See screenshot below.
If we want to save only Test in workbook, we can follow below steps.
Step1: On sheet Test, right click to load menu. Select ‘Move or Copy’.
Step2: After above step, Move or Copy dialog pops up. In Move selected sheets section, under To book, select new book in dropdown list. Then click OK.
Step3: Verify that the sheet Test is removed and saved in another workbook but workbook name is not changed, and the others are kept in current workbook. The two workbooks have the same name.
Step4: If you want to keep worksheet Test in original workbook, you can check on option ‘Create a copy’ in Move or Copy dialog, then it will be kept after moving.
2. Save One Single Worksheet and Remove the Others by VBA Code
If we want to keep only current worksheet and removed the others, we can edit VBA code to remove them directly.
Step1: On current visible worksheet, right click on sheet name tab to load Sheet management menu. Select View Code, Microsoft Visual Basic for Applications window pops up.
Or you can enter Microsoft Visual Basic for Applications window via Developer->Visual Basic. You can also press Alt + F11 keys simultaneously to open it.
Step2: In Microsoft Visual Basic for Applications window, click Insert->Module, enter below code in Module1:
Sub DeleteSheets1() Dim RemoveWS As Worksheet For Each RemoveWS In ThisWorkbook.Worksheets If RemoveWS.Name <> "Sheet1" Then RemoveWS.Delete End If Next Application.DisplayAlerts = True Application.ScreenUpdating = True End Sub
In above code, ‘If RemoveWS.Name <> “Sheet3” Then…’ in this script ‘Sheet3’ is the sheet name you want to save in workbook.
Step3: Save the codes, see screenshot below. And then quit Microsoft Visual Basic for Applications.
Step4: Press F5 to run macro. Verify that below message pops up.
Step5: Click Delete on message. Then you will find worksheets except the defined one in script are removed one by one.
3. Video: Save Only One Single Worksheet in Workbook in Excel
This video will demonstrate how to save only one single worksheet in a workbook using the “Move or Copy” function as well as VBA code.