+ Reply to Thread
Results 1 to 5 of 5

Change worksheet name based on prompt

  1. #1
    Forum Contributor
    Join Date
    09-05-2007
    Posts
    148

    Change worksheet name based on prompt

    I have a workbook with multiple sheets and want them to be renamed based on the value of a certain cell, e.g A5 in each sheet.

    I want to add a prompt so that the user can select a cell, e.g B6, and then it will use that cell from all of the sheets to rename.

    This is the code I have but it doesn't work.

    Please Login or Register  to view this content.
    Also, would there be a way to use the cell value to replace part of the current sheet name?

    E.g my sheet is currently called sheet 1 (1), i want the last 3 charachters removed, and then the value of cell B6 added to the name instead of replaced.

    Thanks

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Change worksheet name based on prompt

    Try changing this line:
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    09-05-2007
    Posts
    148

    Re: Change worksheet name based on prompt

    I get

    runtime error 91
    Object variable or with block variable not set.

    It then refers to this bit of code.

    Please Login or Register  to view this content.
    Any ideas?

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Change worksheet name based on prompt

    Yes. A range is an object and object variables need to be assigned using the Set command:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    09-05-2007
    Posts
    148

    Re: Change worksheet name based on prompt

    So how would I implement the code to do what i need?

    Sorry, just a bit stuck here.

+ 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