ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy a Sheet & Rename based on Cell Value Q (https://www.excelbanter.com/excel-programming/397040-copy-sheet-rename-based-cell-value-q.html)

Sean

Copy a Sheet & Rename based on Cell Value Q
 
I am trying to copy an active sheet to a new sheet and rename based on
the value in A1 (which has a formula that produces a value of ..
"London 07-09-07 12:30", but I'm getting debug on line

ActiveSheet.Name = Range("A1").Value

I guess its the way A1 is formatted, how can I do this?

Thanks


Sub Copy_Rename()
Dim shtName As String
shtName = ActiveSheet.Name
ActiveSheet.Copy after:=ActiveSheet
ActiveSheet.Name = Range("A1").Value
Sheets(shtName).Activate

etc etc

End Sub


Jim Cone

Copy a Sheet & Rename based on Cell Value Q
 

The colon character ":" is not allowed in a sheet name.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Sean"
wrote in message
I am trying to copy an active sheet to a new sheet and rename based on
the value in A1 (which has a formula that produces a value of ..
"London 07-09-07 12:30", but I'm getting debug on line

ActiveSheet.Name = Range("A1").Value
I guess its the way A1 is formatted, how can I do this?
Thanks

Sub Copy_Rename()
Dim shtName As String
shtName = ActiveSheet.Name
ActiveSheet.Copy after:=ActiveSheet
ActiveSheet.Name = Range("A1").Value
Sheets(shtName).Activate
etc etc
End Sub

Sean

Copy a Sheet & Rename based on Cell Value Q
 
On Sep 7, 12:48 pm, "Jim Cone" wrote:
The colon character ":" is not allowed in a sheet name.
--
Jim Cone
San Francisco, USAhttp://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)

"Sean"
wrote in message
I am trying to copy an active sheet to a new sheet and rename based on
the value in A1 (which has a formula that produces a value of ..
"London 07-09-07 12:30", but I'm getting debug on line

ActiveSheet.Name = Range("A1").Value
I guess its the way A1 is formatted, how can I do this?
Thanks

Sub Copy_Rename()
Dim shtName As String
shtName = ActiveSheet.Name
ActiveSheet.Copy after:=ActiveSheet
ActiveSheet.Name = Range("A1").Value
Sheets(shtName).Activate
etc etc
End Sub


Thanks Jim, of course



All times are GMT +1. The time now is 01:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com