+ Reply to Thread
Results 1 to 10 of 10

Name a sheet after a cell value

  1. #1
    Registered User
    Join Date
    06-23-2013
    Location
    Belgium
    MS-Off Ver
    Mac 2011
    Posts
    7

    Name a sheet after a cell value

    Hello,

    I was wondering whether is is possible to give a sheet the name of a value in a cell.
    i.e.: I have written "test" in A2. Now I want the name of the sheet to be "test". But when I change the value of A2 to "edited", I want the name of the sheet to change automatically to "edited".

    (I use excel for Mac)

    Thanks in advance,

    Sogeo

  2. #2
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Name a sheet after a cell value

    Hi..

    You need to add some code to the Sheet Change Event...

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-23-2013
    Location
    Belgium
    MS-Off Ver
    Mac 2011
    Posts
    7

    Re: Name a sheet after a cell value

    It doesn't seem to work? I added the code into the VBE of that particular sheet.

  4. #4
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Name a sheet after a cell value

    Hi..

    Is it the first sheet in your workbook?

    If not.. change the Sheet(1) part to suit..

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

    Re: Name a sheet after a cell value

    Put this code in a sheet where ever your data in B2 are.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-23-2013
    Location
    Belgium
    MS-Off Ver
    Mac 2011
    Posts
    7

    Re: Name a sheet after a cell value

    Hmm, I can't get it to work.. (I haven't used VBA ever before).
    Could anyone tell me what I'm doing wrong?

    I added the workbook as an attachment.

    (It's the first sheet that needs to change it's name automatically to the value of cell C2)
    Attached Files Attached Files

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

    Re: Name a sheet after a cell value

    You have my code twice, one on the module and the other on sheet1. Please remove it from the module, so have only one in sheet1. I have tried and works for me. I do not know why it does not work, is it because you have a mac? I do not know.

  8. #8
    Registered User
    Join Date
    06-23-2013
    Location
    Belgium
    MS-Off Ver
    Mac 2011
    Posts
    7

    Re: Name a sheet after a cell value

    Hmm weird. Deleted the module now but still doesn't work.. It's probably because I'm on a mac?

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

    Re: Name a sheet after a cell value

    It also may be your events have been disabled. I do not know what key stroke you use in mac,but in window while your cursor is at sheet1, CTRL+ G, will open a new window, or go to menu- view-select immediate window. While you have this window, type
    application.EnableEvents=True
    and hit the enter(Ok), then go back and try to change the value in C2 and see if this works.

  10. #10
    Registered User
    Join Date
    06-23-2013
    Location
    Belgium
    MS-Off Ver
    Mac 2011
    Posts
    7

    Re: Name a sheet after a cell value

    It works now, thanks for the help guys!

+ 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