Results 1 to 4 of 4

Thread: renaming excel sheets with vba
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    May 2019
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default renaming excel sheets with vba

    hi,

    i am trying to do some macro on an existing report in excel - its a client account statement - if the client has multiple accounts it will seperate them out into sheets and name each sheet for example John, John 1, John 2, John 3, john 4. depending on the client there could be 2 sheets or 10 sheets. i am looking to rename all sheets back to sheet 1, sheet 2, sheet 3 to keep it generic. is that possible?

    thanks,

  2. #2
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    23,961
    Post Thanks / Like
    Mentioned
    408 Post(s)
    Tagged
    42 Thread(s)

    Default Re: renaming excel sheets with vba

    How about
    Code:
    Sub jazzD()
       Dim i As Long
       
       For i = 1 To Sheets.Count
          Sheets(i).Name = "Sheet " & i
       Next i
    End Sub
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  3. #3
    New Member
    Join Date
    May 2019
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: renaming excel sheets with vba

    Quote Originally Posted by Fluff View Post
    How about
    Code:
    Sub jazzD()
       Dim i As Long
       
       For i = 1 To Sheets.Count
          Sheets(i).Name = "Sheet " & i
       Next i
    End Sub
    thanks! worked a treat,

  4. #4
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    23,961
    Post Thanks / Like
    Mentioned
    408 Post(s)
    Tagged
    42 Thread(s)

    Default Re: renaming excel sheets with vba

    You're welcome & thanks for the feedback
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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