Announcement

Collapse
No announcement yet.

Display Last Update Date & Time

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Display Last Update Date & Time

    Hi all

    I want to display on a spreadsheet, "last update date & time"; Is there a function to do it??

    Many thanks in advance
    Moony

  • #2
    Re: Last Upadate

    Hi

    put this in a cell, say A1:

    last update date & time

    Then, add this bit of code:

    Code:
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Dim iResponse As Integer
    iResponse = MsgBox("Do you want to update cell B1 with the current date and time?", vbQuestion + vbYesNoCancel, "Update")
        If iResponse = vbYes Then Range("B1").Value = Now
    End Sub
    Wigi
    Regards,

    Wigi

    Excel MVP 2011-2014

    For more Excel memes: visit http://www.wimgielis.com ==> English articles ==> Excel memes

    -- Topics without [CODE] tags or a meaningful topic title, will be neglected by me (and probably many others as well) --

    Comment


    • #3
      Re: Last Upadate

      Many thanks for your prompt reply
      But actually I'm kind of new to excel vba, so would please mind showing me where exactly to put this code and how to get there??

      Many thanks again.
      Moony

      Comment


      • #4
        Re: Last Upadate

        Moony

        If you fill in your "assumed experience" in your profile, you probably get more or less detailed information.

        - Hit Alt-F11, you're now in the VBA environment.
        - Locate your file in VBA project
        - Dubble left click on that file name
        - Locate "ThisWorkbook" in your current file
        - Paste the code in the white window
        - Return to Excel with again Alt-F11

        Do you succeed?

        Wigi
        Regards,

        Wigi

        Excel MVP 2011-2014

        For more Excel memes: visit http://www.wimgielis.com ==> English articles ==> Excel memes

        -- Topics without [CODE] tags or a meaningful topic title, will be neglected by me (and probably many others as well) --

        Comment


        • #5
          Re: Last Upadate

          You can get it from the workbook proeprties.

          Code:
          '-----------------------------------------------------------------
          Function DocProps(prop As String)
          '-----------------------------------------------------------------
             Application.Volatile
             On Error GoTo err_value
             DocProps = ActiveWorkbook.BuiltinDocumentProperties _
             (prop)
             Exit Function
          err_value:
             DocProps = CVErr(xlErrValue)
          End Function
          and enter in a cell such as
          =DocProps ("Last Save Time")
          and format as required
          HTH

          Bob

          Comment

          Working...
          X