+ Reply to Thread
Results 1 to 7 of 7

VBA to update the date in my timesheet

  1. #1
    Registered User
    Join Date
    10-03-2011
    Location
    Pensacola, Fl
    MS-Off Ver
    Excel 2007
    Posts
    8

    VBA to update the date in my timesheet

    I have a worksheet that I am just toying with for my timesheet. I have a little macro where I press ctrl+n to create a new timesheet for a new pay period within the workbook. I am wanting it to update the new worksheet with the correct date (+1 day from the last day on the previous sheet) everytime I make a new worksheet. Also, If it could name the worksheet with those dates similarly to how I have the sheet named in the attached document. (not sure if this last part can be done).
    Attached Files Attached Files
    Last edited by joeyheaf; 10-05-2011 at 01:55 PM.

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VBA to update the date in my timesheet

    try this macro:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-03-2011
    Location
    Pensacola, Fl
    MS-Off Ver
    Excel 2007
    Posts
    8

    [SOLVED] Re: VBA to update the date in my timesheet

    worked great, nice little piece of code you wrote there. Thanks
    Last edited by joeyheaf; 10-05-2011 at 01:55 PM. Reason: Solved

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA to update the date in my timesheet

    Try this

    Please Login or Register  to view this content.
    Run the code with the latest sheet active
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA to update the date in my timesheet

    This will work providing the latest sheet is always the first tab
    Please Login or Register  to view this content.

  6. #6
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VBA to update the date in my timesheet

    RoyUK,
    If the date in Q4 is the last day of the month, the next day will be the first day of the next month. Your programming do not take this into account, does it?

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA to update the date in my timesheet

    Try it & see. First day of period set to 18/03/11, so last day is 31/03/11. New sheet covers 01/04/11 to 14/04/11

+ 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