Rename a worksheet that includes a cell refeerence

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following code included in a macro:


Sheets("Week XX").Copy After:=Sheets(ActiveWorkbook.Sheets.Count)
Application.Goto Reference:="'Week XX (2)'!R3C3"

What I would like to do is rename the copied worksheet "'Week XX (2)!'" to:

'Week 19' where the number '19' is obtained from cell C3 of the worksheet.
Each time I copy the worksheet cell C3 already has a new unique number
displayed so there will be no chance of a worksheet ever being duplicated.

Thanks for your assistance with this.
 
Maybe

Sub stantial()
Sheets("Week XX").Copy After:=Sheets(ActiveWorkbook.Sheets.Count)
ActiveSheet.Name = "Week XX (2)" & Sheets("Week XX").Range("C3").Value
End Sub

Mike
 
I see how the value from cell C3 is added to the worksheet, however; when I
run the macro the new worksheet is renamed 'Week XX (2) "C3"' and what I am
really looking for is the sheet to be renamed 'Week "C3"'.

I want to replace the 'XX (2)' in the new worksheet with the value of cell
C3. The value in C3 is a whold number such as 19, 20, 25, etc., so that when
the sheet is copied and renamed it is copied and renamed from 'Week XX' to
'Week XX (2)' to 'Week 19' where '19' happens to be the contents of cell C3.

Thanks,

Dave
 

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

Back
Top