Automatically rename sheet to a date in that sheet

NMB311

New Member
Joined
May 28, 2010
Messages
14
I've tried to figure this out on my own and I keep getting the same error.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p></o:p>
I'm trying to copy a template sheet I've made and rename it to a date that is displayed in the new sheet. I keep getting 'Runtime error "1004"'. I know its because sheet names can't contain slashes. And I'm assuming there's a way to change the date to a format that is supported (i.e. changing 6/3/2010 to 6-3-2010 and displaying that as the sheet name). I'm sure there is a way to do it I just can't figure it out. Here is my code:<o:p></o:p>
<o:p></o:p>
Sub NewSheet()

Sheets("Blank").Select
Sheets("Blank").Copy before:=Sheets("Blank")
Sheets("Blank (2)").Name = Range("A2").Value

End Sub<o:p></o:p>

<o:p></o:p>
Any help would be much appreciated :)<o:p></o:p>
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
You're just about there. Change the name to equal:
Format(Range("A2").Value,"d-m-yyyy")
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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