1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Excel 2003 - add worksheet date last modified to a cell

Discussion in 'Business Applications' started by snorkytheweasel, Oct 17, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. snorkytheweasel

    snorkytheweasel Thread Starter

    Joined:
    May 3, 2006
    Messages:
    215
    In cell A2 I want to display the date that the worksheet was last modified.

    Is there a function that does this?

    Or is this a job for VBA? If so , how do I do this (from scratch)?

    TIA, TTFN
     
  2. bomb #21

    bomb #21

    Joined:
    Jul 1, 2005
    Messages:
    8,445
    I guess by modified you mean "changed and saved", since a file that's modified but closed without saving isn't techinically modified. (?)

    Try the code below in the Workbook module (which you should be able to get at by rightclicking the Excel icon left of "File" in the menu bar and choosing "View Code" from the pop-up).

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Sheets("Sheet1").Range("A2") = Date
    End Sub
     
  3. snorkytheweasel

    snorkytheweasel Thread Starter

    Joined:
    May 3, 2006
    Messages:
    215
    That worked - Thanks!

    I was unable to modify the date format when using Format -> Cells -> Date.

    It's not the end of the world, but it begs the question: am I doing something wrong?
     
  4. bomb #21

    bomb #21

    Joined:
    Jul 1, 2005
    Messages:
    8,445
    You can modify by entering the cell (F2), then pressing Enter to exit.

    But to be honest, I don't know -- I'll look it up.
     
  5. Zack Barresse

    Zack Barresse

    Joined:
    Jul 25, 2004
    Messages:
    5,452
    Code:
    Sheets("Sheet1").Range("A2") = Format(Date, "mm-dd-yy")
    HTH
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/639553

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice