Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rename Worksheet From Cell Data navel151 Excel Worksheet Functions 6 February 22nd 10 04:39 PM
Rename Worksheet Tabs per Cell Content JEFF Excel Programming 2 May 15th 07 06:41 PM
Rename a Worksheet on Input of Value in Cell John Excel Worksheet Functions 1 August 24th 06 05:29 PM
VBA to Rename Excel Worksheet Value of Cell. [email protected] Excel Programming 3 July 24th 06 09:25 PM
how do i rename worksheet to equal cell name MissSunshineKiss Excel Worksheet Functions 2 June 28th 05 02:05 AM


All times are GMT +1. The time now is 10:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"