Help with Renamaing a Worksheet

Rocky0201

Active Member
Joined
Aug 20, 2009
Messages
278
Hi,

The following code copies an existing worksheet:

Code:
    QNSheet = "QN " & Application.UserName
    With Sheets("Quick Notes")
        .Copy After:=Sheets(Sheets.Count)
    End With

What I need to do is rename the copied worksheet to the value in QNSheet. I tried using a variation of examples that I found in some posts but receive run-time errors.

Any help would greatly be appreciated.

Thanks,
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Code:
    QNSheet = "QN " & Application.UserName
    Sheets("Quick Notes").Copy After:=Sheets(Sheets.Count)
    ActiveSheet.Name = QNSheet
 
Upvote 0
Thanks patel45 for your response.

The problem is, I run this code in my sheet called Survey. When I execute ActiveSheet.Name, the Sheet Survey gets renamed to the value QNSheet instead of the sheet just copied "Quick Notes (2)". Since I cannot be always certain that the copy will create Quick Notes (2), is there a way to rename Quick Notes (2) to the value I built in QNSheet?
 
Upvote 0
After execution of this line
Code:
Sheets("Quick Notes").Copy After:=Sheets(Sheets.Count)
the ActiveSheet is the new created sheet, not the original sheet
 
Upvote 0
Hi

Try:-
Code:
ActiveSheet.Name = "QN " & Application.UserName

hth
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,823
Messages
6,121,777
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top