Delete an Excel worksheet in another workbook

How to delete an Excel worksheet in another open or closed workbook using VBA

METHOD 1. Delete an Excel worksheet in another open workbook using VBA

VBA

Sub Delete_Worksheet_in_Another_Open_Workbook()
'declare variables
Dim wb As Workbook
Dim ws As Worksheet
Set wb = Workbooks("Exceldome.xlsx")
'activate the workbook
wb.Activate
Set ws = Worksheets("Sheet2")
'delete a worksheet named Sheet2 in the workbook specified above
ws.Delete

End Sub

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

Sub Delete_Worksheet_in_Another_Closed_Workbook()
'declare variables
Dim wb As Workbook
Dim ws As Worksheet
Set wb = Workbooks.Open("C:\Excel\Exceldome.xlsx")
'open and activate the workbook
wb.Activate
Set ws = Worksheets("Sheet2")
'delete a worksheet named Sheet2 in the workbook specified above
ws.Delete

End Sub

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

Explanation about how to delete a worksheet in another workbook

EXPLANATION

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