How name a copied worksheet?

D

David

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
 
C

Chip Pearson

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 (e-mail address removed)
 
H

Harald Staff

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top