+ Reply to Thread
Results 1 to 5 of 5

Automatically change a worksheet reference when a new worksheet is added

  1. #1
    Registered User
    Join Date
    11-21-2008
    Location
    Vancouver
    MS-Off Ver
    Office 2013
    Posts
    11

    Automatically change a worksheet reference when a new worksheet is added

    Hi there,

    What I am trying to do is have a function update automatically whenever a new worksheet is added to my workbook.

    This is the base formula I want. I have tested and it works.
    Please Login or Register  to view this content.
    Now, what I want to do is have worksheet5 update every time I add a new sheet. Ex. When I add worksheet6 I want the function to update to this:
    Please Login or Register  to view this content.
    .

    I used an idea I found on eggheadcafe, submitted by Peter Atherton. It involves creating a User Defined Function like so:

    Please Login or Register  to view this content.
    I then put in a cell(E29) this:
    Please Login or Register  to view this content.
    .

    This results in E29 being populated with
    Please Login or Register  to view this content.
    . In another cell I put
    Please Login or Register  to view this content.
    and I get #REF! I tried naming cell E29 and using the name in the formula, but got the same result. When I evaluate the formula it shows that it is evaluating E29 before the indirect function, so that when it gets to the function it is actually evaluating as
    Please Login or Register  to view this content.
    . That shouldn't happen, should it?

    thanks,
    Damon
    Last edited by crayadder; 12-03-2008 at 05:47 PM.

  2. #2
    Registered User
    Join Date
    11-21-2008
    Location
    Vancouver
    MS-Off Ver
    Office 2013
    Posts
    11
    Bump no response

  3. #3
    Registered User
    Join Date
    06-14-2007
    Posts
    6
    I haven't tried this yet but saw the idea a few months ago when I was looking for something else. Insert a blank worksheet at the front and the end of your workbook. Have your forumulas reference the cells starting with the first blank worksheet and ending with the last blank worksheet. Insert worksheets before the last blank as needed. Hope this is what you were looking for.
    Jay

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Summed sheets to include added sheets

    (Copied from my yesterday post)

    Try this...

    Insert a new worksheet BEFORE the first sheet.
    Name the new sheet: FirstSheet

    Insert a new worksheet AFTER the last sheet.
    Name the new sheet: LastSheet

    Now this formula sums Col_K in all sheets between FirstSheet and LastSheet, inclusive:

    Please Login or Register  to view this content.


    Now, when you insert a sheet anywhere between FirstSheet and LastSheet,
    it will be includeded in the sum.

    Does that help?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  5. #5
    Registered User
    Join Date
    11-21-2008
    Location
    Vancouver
    MS-Off Ver
    Office 2013
    Posts
    11

    Re: Automatically change a worksheet reference when a new worksheet is added

    This is a ridiculously late response, but I just wanted to give credit to both jvmjr and Ron for their input. I forgot all about this and I don't even remember what workbook I was doing this in anymore. LOL. If I ever remember or need to do the same thing again I will definitely try out your suggestion Ron!

    Thanks both.

    crayadder

+ 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