+ Reply to Thread
Results 1 to 3 of 3

Automatically change Sheet names by typing in a cell

  1. #1
    Registered User
    Join Date
    04-20-2008
    Posts
    33

    Automatically change Sheet names by typing in a cell

    Hi all,
    I have a workbook template that has 31 sheets in it, the first 2 of which are defined by the template, the others can be user modified.
    On the first sheet, there is a list of the names of the other sheets (amongst other data) in B3:B31, and I would like to be able to change the names of the associated sheets by changing these cells contents. The order of names in the list doesn't change, but the order of the sheets in the book can.
    I have written the below code, which works, but is really slow, even just changing cells with the keypad causes it run and so hang for a second.
    The other issue with it is that it refers to the sheets using their position in the book (sheets (ref)) which can change, or other sheets get inserted, but I dont know how to to apply the sheet# method of reference when the number needs to change. I know I can hard code a lot of this but would prefer a more elegant method.
    I know there must be a much better way of doing this, but I cant work it out.



    Please Login or Register  to view this content.

    Thanks,

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Automatically change Sheet names by typing in a cell

    Maybe like so:
    Please Login or Register  to view this content.

    Sample file attached.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Automatically change Sheet names by typing in a cell

    If the order isn't constant then try this.

    In the Sheet Module:
    Please Login or Register  to view this content.
    The code uses this Function to test for a bad name, place it in a Code Module:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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