ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How name a copied worksheet? (https://www.excelbanter.com/excel-programming/273628-how-name-copied-worksheet.html)

David

How name a copied worksheet?
 
I was given this code to copy a worksheet to another:

Activesheet.copy After:=ActiveSheet


How do I give the new worksheet a name rather than it
using the same name with a number in parentheses after it?

- David




Chip Pearson

How name a copied worksheet?
 
David,

The new sheet is the active sheet after a Copy operation, so you
can use ActiveSheet. E.g.,

ActiveSheet.Name = "NewName"



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"David" wrote in message
...
I was given this code to copy a worksheet to another:

Activesheet.copy After:=ActiveSheet


How do I give the new worksheet a name rather than it
using the same name with a number in parentheses after it?

- David






Harald Staff[_4_]

How name a copied worksheet?
 
Hi David

Name it "Harald". Great norwegian name, done like this:

Sub test()
On Error Resume Next
ActiveSheet.Copy After:=ActiveSheet
ActiveSheet.Name = "Harald"
End Sub

-yes, it's a separate operation. I think it has to be that way.
--
HTH. Best wishes Harald
Excel MVP

Followup to newsgroup only please.

"David" wrote in message ...
I was given this code to copy a worksheet to another:

Activesheet.copy After:=ActiveSheet


How do I give the new worksheet a name rather than it
using the same name with a number in parentheses after it?

- David







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

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