+ Reply to Thread
Results 1 to 5 of 5

Changing Sheet Names Based on # Values in Names

  1. #1
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Thumbs up Changing Sheet Names Based on # Values in Names

    Hi all,
    I have two Excel files, one contains our data, and the other is from our source. The source data needs to be transferred into our file. The source file contains 58 sheets of data which needs to be moved to our file. The layout of each sheet in the source file is consistent with the layout in our file (thankfully). The problem is, the sheet names in the source file do not match the sheet names in our file.
    Our file has sheet names "1","2",..."58". A straight up number sequence
    The source file sheets names are: "tab01-eng","tab02-eng"..."tab58-eng".
    This (to me at least) poses a problem.
    I was wondering, is it possible to remove all text from the sheet names and leave just the numbers without going at it manually? I've been trying to re-name the sheets based on the number values inside the name but have not been successful. As always, any help is greatly appreciated.

    Regards
    Last edited by Mordred; 09-01-2010 at 03:21 PM.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Changing Sheet Names Based on # Values in Names

    Hi,

    The following macro should do the job.

    Please Login or Register  to view this content.
    HTH
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Changing Sheet Names Based on # Values in Names

    Maybe like this:
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Changing Sheet Names Based on # Values in Names

    Thanks to you both for your suggestions.
    @shg
    Your code produce a Run-time error '1004'. I'm thinking its probably because there are other sheets in the source file that aren't transferred to our file. I don't know why exactly but that was the outcome.
    @Richard
    Your suggestion did the job, I added this
    Please Login or Register  to view this content.
    to get rid of the 0 too.

    Thanks

  5. #5
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Changing Sheet Names Based on # Values in Names

    It turns out I had to remove this
    Please Login or Register  to view this content.
    because of sheets 10,20, etc...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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