+ Reply to Thread
Results 1 to 3 of 3

Rename worksheet name "Sheet1" in VBA

  1. #1
    Registered User
    Join Date
    12-19-2003
    Posts
    7

    Question Rename worksheet name "Sheet1" in VBA

    How to rename the worksheet name "Sheet1" to "File1" in VBA?
    My VBA coding as follows:
    Sub Copyfile()
    FileCopy ("C:\Data2006.xls"), C:\Book1.xls
    End Sub

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    XL 2010,2016
    Posts
    11,773

    Change Sheet Names

    here are four codes you can use

    Sub Macro2()
    '
    ActiveSheet.Name = "File1"
    End Sub
    Sub Macro3()
    '
    ActiveSheet.Name = Range("a1")
    End Sub
    Sub Macro6()
    '
    Sheets(1).Name = "File1"
    End Sub
    Sub Macro7()
    '
    Sheets(1).Name = Sheets(2).Range("A1")
    End Sub
    Last edited by davesexcel; 11-29-2006 at 03:33 AM.

  3. #3
    Valued Forum Contributor
    Join Date
    07-17-2005
    Location
    Abergavenny, Wales, UK
    MS-Off Ver
    XL2003, XL2007, XL2010, XL2013, XL2016
    Posts
    608

    Re: Rename worksheet name "Sheet1" in VBA

    Hi

    If you use Workbooks.Add 1 then you will create a new workbook with just 1 sheet, which you can then delete at the end.
    Maybe something like

    Please Login or Register  to view this content.
    --
    Regards
    Roger Govier
    Microsoft Excel MVP

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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