Insert an Excel worksheet in another workbook

How to insert a single Excel worksheet in another open or closed workbook using VBA

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

VBA

Sub Insert_Worksheet_in_Another_Open_Workbook()
'declare a variable
Dim wb As Workbook
Set wb = Workbooks("Exceldome.xlsx")
'insert a new worksheet in front of an active sheet in the workbook specified above
wb.Worksheets.Add

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.
ADJUSTABLE PARAMETERS
Workbook Selection: Select the workbook where you want to insert a new worksheet by changing the Exceldome.xlsx workbook name in the VBA code to any open workbook.

ADDITIONAL NOTES
Note 1: When the VBA code is absent of reference to a specific sheet in front of or before which to insert a new worksheet, as per this example, a worksheet will be inserted in front of an active sheet.

METHOD 2. Insert an Excel worksheet in another closed workbook using VBA

VBA

Sub Insert_Worksheet_in_Another_Closed_Workbook()
'declare a variable
Dim wb As Workbook
Set wb = Workbooks.Open("C:\Excel\Exceldome.xlsx")
'open the workbook specified above and insert a new worksheet in front of an active sheet
wb.Worksheets.Add

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 Location: Have a workbook that you are referencing to in the VBA code 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.
ADJUSTABLE PARAMETERS
Workbook Location: Select the location of the workbook where you want to insert a new worksheet by changing the C:\Excel\ path.
Workbook Selection: Select the workbook where you want to insert a new worksheet by changing the Exceldome.xlsx workbook name in the VBA code to any closed workbook that is located in the path provided in the VBA code.

ADDITIONAL NOTES
Note 1: When the VBA code is absent of reference to a specific sheet in front of or before which to insert a new worksheet, as per this example, a worksheet will be inserted in front of an active sheet.

Explanation about how to insert a worksheet in another workbook

EXPLANATION

EXPLANATION
This tutorial explains and provides step by step instructions on how to insert a single worksheet in another open or closed workbook using VBA.

You can insert a new worksheet in another workbook that is open by referencing to that specific workbook. If this is the approach that you intend to implement, please ensure that the workbook that you are referencing to is open when the VBA code is run.

You can also insert a new worksheet in another workbook that is closed by referencing to and opening that specific workbook, through the use of the VBA code. If this is the approach that you intend to implement, please ensure that the workbook that you are referencing to is closed when then VBA code is run.

ADDITIONAL NOTES
Note 1: When the VBA code excludes reference to a specific sheet before or after which to insert a new worksheet, a worksheet will be inserted in front of an active sheet. Both of the examples in this tutorial exclude any reference to a specific sheet before or after which to insert a new worksheet, therefore a worksheet will be inserted in front of an active sheet in the Exceldome.xlsx workbook.

RELATED TOPICS

Related Topic Description Related Topic and Description
How to insert a single Excel worksheet using Excel, VBA and Shortcut methods
How to delete a single Excel worksheet using Excel, VBA and Shortcut methods
How to insert multiple Excel worksheets in another open or closed workbook using VBA
How to insert an Excel worksheet in multiple open or closed workbooks using VBA
How to insert a single Excel chart sheet in another open or closed workbook using VBA