+ Reply to Thread
Results 1 to 12 of 12

Creating a sequential date over multiple tabs.

  1. #1
    Registered User
    Join Date
    05-23-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    7

    Lightbulb Creating a sequential date over multiple tabs.

    Hi,

    I have a spreadsheet with around 31 tabs (for the months of Jan, Feb, March etc).

    I know how to do =Jan 1!A1+1 on Jan 2 and =Jan 2!A1+1 on Jan 3 etc or =Jan 1!A1+1 on Jan 2 and =Jan 1!A1+2 on Jan 3 etc and that works but I would have to do that on every sheet so I may as well just manually write the date in on each. I would like a formula so that I can put 1/1/13 in A1 on the first tab and it will automatically put 2/1/13 in A1 on the second tab, then 3/1/13 in A1 on the third tab and so on.

    I got the below off a forum here but for the life of me, it is not working.

    Can someone please help?


    Re: Sequential Dates Over Multiple Worksheets

    It could be as simple as

    =Sheet01!B1+1 on sheet02 and =Sheet02!B1+1 on sheet03 etc.

    Alternatively, to avoid having to create a separate version of the formula on each sheet, you could use the following user defined function.

    Please Login or Register  to view this content.
    To use this, open the VBA editor (Alt F11) , add a new module (right click on the appropriate VBA project - insert- module) and paste the above in.

    Then add the formula

    =AddSequentialDate("B1",B1)

    to each B2 on sheets 02 onwards. The function works out which sheet it is on and adds one to the sheet before.

    Hope this helps.
    Last edited by arlu1201; 05-27-2013 at 04:24 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Creating a sequential date over multiple tabs.

    The function needs to be in a code module and the syntax takes the form :-
    Please Login or Register  to view this content.
    sheet1 A1 would have day 1............. A1 in all other sheets would have the above function and display sequential dates.
    Hope this helps
    Elegant Simplicity............. Not Always

  3. #3
    Registered User
    Join Date
    05-23-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Creating a sequential date over multiple tabs.

    Quote Originally Posted by AndyLitch View Post
    The function needs to be in a code module and the syntax takes the form :-
    Please Login or Register  to view this content.
    sheet1 A1 would have day 1............. A1 in all other sheets would have the above function and display sequential dates.
    Hope this helps

    Nope... Still no luck, the box just displays #NAME?

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Creating a sequential date over multiple tabs.

    Please Login or Register  to view this content.
    this macro will insert all the dates for you, though it would not be formula

  5. #5
    Registered User
    Join Date
    05-23-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Creating a sequential date over multiple tabs.

    Quote Originally Posted by humdingaling View Post
    Please Login or Register  to view this content.
    this macro will insert all the dates for you, though it would not be formula

    I will try this but where do i put it? In the VBA?

  6. #6
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Creating a sequential date over multiple tabs.

    yes
    put into module in VBA

  7. #7
    Registered User
    Join Date
    05-23-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Creating a sequential date over multiple tabs.

    Quote Originally Posted by humdingaling View Post
    yes
    put into module in VBA
    Okay I think I need a little more direction on this... I'm still new with the VBA.

    I put that first code you gave me in a new module just for the first tab one or all tabs?

    Then do I put anything in A1 on each tab?

    Sorry to be a pain and thanks for your help

  8. #8
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Creating a sequential date over multiple tabs.

    the way the macro works
    you enter first date into first tab "A1" ie 30th May
    run macro
    it will run thru every single tab and put the next day into A1 into subsequent tabs
    ie 2nd tab = 31st may, 3rd = 1st june, etc

    i have attached the macro into example spreadsheet

    you can either assign it into your own workbook (like the example) or you can assign it into your own personal macro list
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    05-23-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    7

    Thumbs up Re: Creating a sequential date over multiple tabs.

    Quote Originally Posted by humdingaling View Post
    the way the macro works
    you enter first date into first tab "A1" ie 30th May
    run macro
    it will run thru every single tab and put the next day into A1 into subsequent tabs
    ie 2nd tab = 31st may, 3rd = 1st june, etc

    i have attached the macro into example spreadsheet

    you can either assign it into your own workbook (like the example) or you can assign it into your own personal macro list


    VOILA!Amazing it worked

    Thank you very much :D

  10. #10
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Creating a sequential date over multiple tabs.

    glad it worked

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  11. #11
    Registered User
    Join Date
    09-08-2020
    Location
    Nevada
    MS-Off Ver
    2007
    Posts
    1

    Re: Creating a sequential date over multiple tabs.

    This module worked for me as well, however, the issue I am running into is when I save the excel file and then goto re-open it and change the date in the first sheet (i.e. now I want to auto-fill all December's dates) I change it to 12/1/20 yet sheets 2 thru 30 do not auto adjust to the december dates. Instead they stay as is, on the date they previously showed. I have to re-group all these sheets, and re-enter the =Addsequentialdate formula for them to adjust. Is there a way to fix this so I can open this file anytime, change the date in the first sheet and every sheet after will adjust correctly? Thank you!

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Creating a sequential date over multiple tabs.

    Quote Originally Posted by andrewp0502 View Post
    This module worked for me as well, however, the issue I am running into is when I save the excel file and then goto re-open it and change the date in the first sheet (i.e. now I want to auto-fill all December's dates) I change it to 12/1/20 yet sheets 2 thru 30 do not auto adjust to the december dates. Instead they stay as is, on the date they previously showed. I have to re-group all these sheets, and re-enter the =Addsequentialdate formula for them to adjust. Is there a way to fix this so I can open this file anytime, change the date in the first sheet and every sheet after will adjust correctly? Thank you!
    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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