ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy sheets. (https://www.excelbanter.com/excel-programming/325306-copy-sheets.html)

Tom

Copy sheets.
 
Hello,

how can I copy sheets in same workbook and set immedietly new name for this
"copy" by one instruction.
When I used Sheets("test").Copy excel automaticly generate "test (2)" or
"test (3)", this I dont need.

thanks Tom



Yogendra

Copy sheets.
 
There is a way to beat this.

If you have observed, when you copy a sheet, the newly created sheet is
active.

after copy, you can immediately use activesheet.name = "your_name" then
you can control this.

Sub copy_sheet()

Sheets("Sheet1").Copy After:=Sheets(1)
ActiveSheet.Name = "Newname"

End Sub



All times are GMT +1. The time now is 05:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com