Delete an Excel worksheet in another workbook
How to delete an Excel worksheet in another open or closed workbook using VBA
Dim wb As Workbook
Dim ws As Worksheet
wb.Activate
ws.Delete
End Sub
Workbooks: The Workbooks object represents all of the open Excel workbooks.
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Workbook Name: Have an open workbook named Exceldome.xlsx.
Worksheet Name: Have a worksheet named Sheet2 in the Exceldome.xlsx workbook.
ADJUSTABLE PARAMETERS
Worksheet to Delete: Select the worksheet that you want to delete by changing the Sheet2 worksheet name in the VBA code to any worksheet in the workbook.
Workbook Selection: Select the workbook where you want to delete a worksheet by changing the Exceldome.xlsx workbook name to any open workbook.
METHOD 2. Delete an Excel worksheet in another closed workbook using VBA
VBA
Dim wb As Workbook
Dim ws As Worksheet
wb.Activate
ws.Delete
End Sub
Workbook: The Workbooks object represents all of the open Excel workbooks.
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Workbook Location: Have a workbook that you are referencing to in the VBA code located on your device in the C:\Excel\ path.
Workbook Name: Have a closed workbook named Exceldome.xlsx in the location specified in the VBA code.
Worksheet Name: Have a worksheet named Sheet2 in the Exceldome.xlsx workbook.
ADJUSTABLE PARAMETERS
Worksheet Location: Select the location of the workbook where you want to delete a worksheet by changing the C:\Excel\ path.
Workbook Selection: Select the workbook where you want to delete a worksheet by changing the Exceldome.xlsx workbook name to any closed workbook that is located in the path specified in the VBA code.
Worksheet to Delete: Select the worksheet that you want to delete by changing the Sheet2 worksheet name in the VBA code to any worksheet in the workbook.
This tutorial explains and provides step by step instructions on how to delete a single worksheet in another workbook using VBA.
VBA Methods: Using VBA you can delete a worksheet in another open or closed workbook by referencing to a specific workbook. If a workbook is closed, the VBA code will first need to open the workbook and then delete the specified worksheet.