Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / January 2007

Tip: Looking for answers? Try searching our database.

Renaming sheet

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Manuel Murieta - 19 Jan 2007 22:38 GMT
I would like a macro that will rename a sheet to today's date.  I already
have the date set in A1 as val(today()) so that it doesn't change once the
sheet is copied and viewed another day. Now I would like the macro to name
the sheet as the date.  Since the program enters the date as 1/19/07 I have
been renaming the sheet manually as 1-19-07 since the sheet cannot accept
the "/" as part of the name.
JE McGimpsey - 19 Jan 2007 22:47 GMT
One way:

  Public Sub RenameSheetToday()
       Dim sName As String
       sName = Format(Date, "m-d-yy")
       With ActiveSheet
           On Error Resume Next
           .Name = Format(Date, "m-d-yy")
           On Error GoTo 0
           If .Name <> sName Then _
               MsgBox "Couldn't rename worksheet to '" & sName & "'"
       End With
   End Sub

> I would like a macro that will rename a sheet to today's date.  I already
> have the date set in A1 as val(today()) so that it doesn't change once the
> sheet is copied and viewed another day. Now I would like the macro to name
> the sheet as the date.  Since the program enters the date as 1/19/07 I have
> been renaming the sheet manually as 1-19-07 since the sheet cannot accept
> the "/" as part of the name.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.