+ Reply to Thread
Results 1 to 7 of 7

Is it possible for worksheet name to change whenever a specified cell changes

  1. #1
    Registered User
    Join Date
    07-22-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    85

    Is it possible for worksheet name to change whenever a specified cell changes

    Hi,

    I was wondering whether it would be possible for a worksheet name to change automatically.

    normally in order to change a worksheet name we would

    worksheets("xxx").select
    activesheet.name ="cells(x,y)"

    but you have to run the macro before the sheet changes the name to the cells(x,y) if let say you have changed the contents of that cell. How do you make it such that once u change the cell, the sheet name also changes automatically?
    Last edited by kchm_2000; 04-25-2011 at 06:46 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Is it possible for worksheet name to change whenever a specified cell changes

    You need to use events for this to happen automatically.

    If you place this in the Thisworkbook object then it will catch all cell changes on all worksheets.
    You can add a test to restrict the cells able to alter the sheet name. In this example it is cell A1 on any sheet.

    Please Login or Register  to view this content.
    Invalid names will cause the sheet to remain unchanged
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    07-22-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    85

    Re: Is it possible for worksheet name to change whenever a specified cell changes

    oh thanks a lot the code works well but how do I add restrictions I am still fairly new to VBA and need more instructions?

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Is it possible for worksheet name to change whenever a specified cell changes

    What sort of restrictions? My ability to read minds is nonexistent

  5. #5
    Registered User
    Join Date
    07-22-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    85

    Re: Is it possible for worksheet name to change whenever a specified cell changes

    sorry I for my careless response, I hope to just restrict it to only one worksheet how can I do that?

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Is it possible for worksheet name to change whenever a specified cell changes

    Use the sheet object and it's change event.
    Right click the sheet tab of the sheet you want to change.
    Paste the following.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-22-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    85

    Re: Is it possible for worksheet name to change whenever a specified cell changes

    thanks a lot

+ 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