![]() |
Rename a worksheet that includes a cell refeerence
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. |
Rename a worksheet that includes a cell refeerence
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 "DBavirsha" wrote: 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. |
Rename a worksheet that includes a cell refeerence
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 "Mike H" wrote: 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 "DBavirsha" wrote: 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. |
All times are GMT +1. The time now is 01:23 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com