+ Reply to Thread
Results 1 to 7 of 7

Rename a worksheet

  1. #1
    Forum Contributor
    Join Date
    05-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    259

    Rename a worksheet

    Hi guys, this macro works but is there anyway I can change the
    Please Login or Register  to view this content.
    so that ("Sheet1") can be any number? possibly using the ("*") which i think relates to any number. Every time a sheet is added it goes 2,3,4 etc. At the moment this is set up to change sheet1, any help would be greatly appreciated.



    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Rename a worksheet

    I did not understand what you want, explain better please without any code
    If solved remember to mark Thread as solved

  3. #3
    Forum Contributor
    Join Date
    05-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: Rename a worksheet

    This is part of a bigger macro but i will try. On my spreadsheet there is one worksheet (Worksheet1) I want the macro to add sheets and rename them whatever is in cell AE18. When the macro adds sheets they go sheet2, sheet3 etc. Is there a way I can write a piece of code that covers everything. I can't add how many sheets i need first because this changes from month to month. I'm not sure if that explains it better?

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Rename a worksheet

    There are two ways of naming sheets: string and index.
    The string you now have. Index shows the position of the sheet you want to refer to.
    Please Login or Register  to view this content.
    First sheet within the workbook.

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Rename a worksheet

    sheet2, sheet3 are the default names created by excel. Of course you can change the name of any worksheet, but if you have fixed range(AE18), you will get an error as you have already used it and the sheet name exists.

  6. #6
    Forum Contributor
    Join Date
    05-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: Rename a worksheet

    Okay I'm with you there and I get the error message as you just said the sheet exists. For example if the name in cell (AE18) was (340) the macro would change that. Then if I changed (AE18) to (550) is there anyway of having the macro add the next sheet and change it to (550)?

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Rename a worksheet

    Please Login or Register  to view this content.

+ 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