+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    01-06-2010
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    7

    "Last Modified" Problem

    Hi All - I have a spreadsheet that is updated several times a day and is referred to by many people. I would like to get a "last modified" time in the title bar so that people know the data has been changed. I do this manually by copying the "Last Modified" time from the file properties, but how can this be done automatically?? Any ideas anybody.

  2. #2
    Forum Moderator teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    2003 & 2010
    Posts
    10,042

    Re: "Last Modified" Problem

    Hi martin,

    I'm not quite sure what you mean by Title bar and how you go about copying something into it. Can you explain?

    You could have the last modified date in a cell, which automatically updates whenever the workbook is saved.

    Code:
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
        Dim d
        d = Date & " " & Now
        ActiveSheet.Range("B1").Value = d
    End Sub
    This code goes into the ThisWorkbook module. Change the cell reference from B1 to any other cell you'd prefer.

    hth
    teylyn
    Microsoft MVP - Excel
    At Excelforum, you can say "Thank you!" by clicking the icon below the post.

    Avoid pie charts with more than two data points. Why? See here (pdf, 559 kb). The only acceptable pie chart is here.

  3. #3
    Registered User
    Join Date
    01-06-2010
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: "Last Modified" Problem

    Teylyn
    When I say "copying" all I mean is copy and paste. The "Title Bar" is just a cell where the title of the documents is written, It could simply be cell B1 for example. I've not used code before what do you mean when you say "goes into the ThisWorkbook module"?

    Looking forward to reply

  4. #4
    Forum Moderator teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    2003 & 2010
    Posts
    10,042

    Re: "Last Modified" Problem

    right-click on a sheet tab and select View Code. This will open the VBE (Visual Basic Editor). In the left hand navigation pane, look for ThisWorkbook and double click it (if you have several Excel files open, make sure to select the correct file). Copy the code above and paste it into the code window, which is the big white area of the VBE. Close the VBE.

    The code will automatically run when the workbook is saved, so hit Ctrl-S and you should see cell B1 change.

    hth
    teylyn
    Microsoft MVP - Excel
    At Excelforum, you can say "Thank you!" by clicking the icon below the post.

    Avoid pie charts with more than two data points. Why? See here (pdf, 559 kb). The only acceptable pie chart is here.

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.2.0