+ Reply to Thread
Results 1 to 8 of 8

Including Worksheet names in formulas

  1. #1
    Registered User
    Join Date
    12-15-2009
    Location
    Snohomish, WA
    MS-Off Ver
    Excel 2003
    Posts
    9

    Including Worksheet names in formulas

    I am trying to figure out how to reference worksheet names that change based on cell values.

    For example, we have 52 worksheets - One for each week of the year. We have a date field in the first worksheet and all other sheets calculate the date based on the preceding sheet (cell+7).

    We then have a vba script that changes the name of the worksheet to the date of the week.

    The problem is if we change the date in the first sheet, the script to change the name of the worksheets does not work until you click in the date field of each sheet.

    So the question is how can one have all of the worksheet names updated once the first worksheets date is changed. Hope that makes sense.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Including Worksheet names in formulas

    Hi you could use a worksheet change event that will kick off from the first sheet where you enter the date and rename all the other sheets:

    Please Login or Register  to view this content.
    The code needs to be placed on the sheets code page so right click on the first sheet's tab and select view code. It will then loop through all the other sheets in the workbook renaming the worksheets based on the value in their A1 cell.

    Hope it helps,

    Dom

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Including Worksheet names in formulas

    Dom, might be worth forcing a calculation (just in case) and toggling events accordingly.

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Including Worksheet names in formulas

    The problem is if we change the date in the first sheet, the script to change the name of the worksheets does not work until you click in the date field of each sheet.
    I assumed from this that the code to rename the other sheets was a worksheet change event on each sheet so didn't think a calculation would make much difference. Could be wrong and probably am.

  5. #5
    Registered User
    Join Date
    12-15-2009
    Location
    Snohomish, WA
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Including Worksheet names in formulas

    Thank you for the replies. I think I am getting your ideas. However I do not see how this code increased the date by 7 days. Basically the dates need to be 7 days from the previous sheet. The purpose is to set the start date in sheet one and every other sheet adds 7 days to the previous sheet. This gives a sheet name that is for a specific day of the week over the 52 weeks. It would be great that once the first sheet is updated all sheets follow suit.

    Hope that makes sense and thank you again for all of the help.

  6. #6
    Registered User
    Join Date
    12-15-2009
    Location
    Snohomish, WA
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Including Worksheet names in formulas

    I saw this thread that is perfect, but it does not work with custom formats (i.e. ddmmmyy)

    http://www.ozgrid.com/forum/showthread.php?t=92422

    What am I missing.

    Thanks

  7. #7
    Registered User
    Join Date
    12-15-2009
    Location
    Snohomish, WA
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Including Worksheet names in formulas

    Unfortunately I am up against a deadline and appreciate any input.

  8. #8
    Registered User
    Join Date
    12-15-2009
    Location
    Snohomish, WA
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Including Worksheet names in formulas

    I would greatly appreciate if anyone can provide insight on why I cannot include a date in the formula above. Everything else is perfect.

    Thank you!

+ 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