+ Reply to Thread
Results 1 to 9 of 9

Error Naming Tabs

  1. #1
    Registered User
    Join Date
    05-07-2008
    Posts
    10

    Error Naming Tabs

    Hello,

    I have 20 worksheets all with the following as code to name the tabs:

    Please Login or Register  to view this content.
    This works fine, unless A1 is 0 for more than one sheet. How can I edit the code for each sheet to display a number (specific to the sheet) if there is an error?

    For example, Sheet one could be changed to 0 if error, sheet 2 could be 1 if error and so on. Thanks for your help!!!
    Last edited by dominicb; 05-07-2008 at 05:36 PM.

  2. #2
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,655
    Why change the tab name every time you change the selection? Why not change it only when A1 changes?

    Perhaps this in the ThisWorkbook module:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-07-2008
    Posts
    10
    Unless i did something wrong, putting that code in does not return the value of A1. Did I miss something?

  4. #4
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,655
    It renames the sheet to the contents of A1. If A1 is not valid as a sheet name, it renames it to the sheet index.

    Not what you're wishing to do?

  5. #5
    Registered User
    Join Date
    05-07-2008
    Posts
    10
    Well I must be doing something wrong.
    I've copied the code and I'm not getting a return on A1.
    I put BOB in A1 and I doesn't change to BOB. It reamins the same.
    Have you verified this?
    Thanks for your help, I really appreciate it.

  6. #6
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,655
    yes, I have.

    Take your prior code out of the sheet modules, and put the code I posted in the ThisWorkbook module.

  7. #7
    Registered User
    Join Date
    05-07-2008
    Posts
    10
    Sorry about that. I think I know what the problem is. A1 is a refrence to a cell in another worksheet. The tab doesn't update automatically when the A1 changes from the refrenced cell. Do you happen to know a way around this? Basically i'm wanting tabs in a workbook to be auotmatically named based on the inputed names on a particular worksheet. All worksheets refrence A1 to the "inputed worksheet" if that makes sense.

    Thanks again for your help.

  8. #8
    Registered User
    Join Date
    05-07-2008
    Posts
    10

    Question

    SHG-

    Is there a way to update the taps with going into the a1 refrence and hitting enter?

    Thanks

  9. #9
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,655
    You could do it in the sheet activate event. Then if you switch away from the sheet and switch back, it will update:
    Please Login or Register  to view this content.
    You could do it in the calculate event also, but that seems needlessly weighty.

+ 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