+ Reply to Thread
Results 1 to 3 of 3

Help with sheet renaming macro please

Hybrid View

  1. #1
    Registered User
    Join Date
    03-25-2013
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    26

    Help with sheet renaming macro please

    Sub RenameSheet()
    
    Dim CurrentDate As Variant
    Dim NewName As String
    CurrentDate = Format(Now(), "dd-mmm-yyyy")
    
    Sheets("Sheet1").Select
    Sheets("Sheet1").Name = Test1 - CurrentDate
    Sheets("Sheet2").Select
    Sheets("Sheet2").Name = Test2 - CurrentDate
    Sheets("Sheet3").Select
    Sheets("Sheet3").Name = Test3 - CurrentDate
    
    End Sub
    Hi,

    Excel noob here, can someone please help with above code ?

    I want to re-name Sheet1 to Test1 - Todays date

    It seems to debug.

    Many thanks for your help - ta

  2. #2
    Forum Contributor ragavan.sridar1's Avatar
    Join Date
    11-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010, Excel 2003
    Posts
    208

    Re: Help with sheet renaming macro please

    Try this code.

    Sub RenameSheet()
    
    Dim CurrentDate As Variant
    Dim NewName As String
    CurrentDate = Format(Now(), "dd_mmm_yyyy")
    
    Sheets("Sheet1").Select
    Sheets("Sheet1").Name = "Test1 - " & CurrentDate
    Sheets("Sheet2").Select
    Sheets("Sheet2").Name = "Test2 - " & CurrentDate
    Sheets("Sheet3").Select
    Sheets("Sheet3").Name = "Test3 - " & CurrentDate
    
    End Sub
    Thanks!
    Raga.

    Please,mark your thread [SOLVED] if you received your answer.

    Click the little star * below, to give some Rep if you think an answer deserves it.

    I learnt so many things from these links.

  3. #3
    Registered User
    Join Date
    03-25-2013
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Help with sheet renaming macro please

    Quote Originally Posted by ragavan.sridar1 View Post
    Try this code.

    Sub RenameSheet()
    
    Dim CurrentDate As Variant
    Dim NewName As String
    CurrentDate = Format(Now(), "dd_mmm_yyyy")
    
    Sheets("Sheet1").Select
    Sheets("Sheet1").Name = "Test1 - " & CurrentDate
    Sheets("Sheet2").Select
    Sheets("Sheet2").Name = "Test2 - " & CurrentDate
    Sheets("Sheet3").Select
    Sheets("Sheet3").Name = "Test3 - " & CurrentDate
    
    End Sub
    Thank you very much. Great help. Ta

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help With Excel Macro Renaming Row On Sheet
    By gaspower in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-08-2012, 04:45 PM
  2. [SOLVED] Help with renaming a sheet and referencing that sheet in a macro
    By cober123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-30-2012, 01:18 AM
  3. Error renaming sheet with macro
    By davidjoe in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-03-2012, 07:16 PM
  4. Macro's failing after renaming sheet
    By Aurbo99 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-12-2007, 07:44 PM
  5. Replies: 6
    Last Post: 07-25-2006, 10:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1