In this post, you’ll learn how you can copy worksheets in your Excel spreadsheet using Excel VBA.
Copy Worksheets in Excel VBA
To copy the sheets, use .copy command in your code. Let us see the different operations that we can perform using the .copy command.
Copy Worksheet to New Workbook
To copy a worksheet to a new Workbook, enter the following code in the Visual basics tab.
The sheet, Sheet 1 was copied to a new workbook.
Copy ActiveSheet to New Workbook
To copy the ActiveSheet to a new Workbook,
Here, the active sheet was Sheet 3, which was copied to a new workbook.
Copy Sheet Within Same Workbook
Now, let us see how to copy and paste worksheets within the same workbook.
There are three options to copy paste the worksheet in the same workbook.
- Before a sheet
- Before the first sheet
- After Last sheet
Copy a sheet before a worksheet
To copy a sheet before a worksheet
Copy Sheet Before First Sheet
To copy sheet before the first sheet,
Copy Sheet After Last Sheet
To copy the sheet after the last sheet,