+ Reply to Thread
Results 1 to 7 of 7

Date Macro

Hybrid View

  1. #1
    Registered User
    Join Date
    11-23-2007
    Posts
    12

    Date Macro

    Hi,

    How do i set up a macro so that when a spreadsheet is updated the date will update to represent this?

    Thanks

    Mike

  2. #2
    Registered User
    Join Date
    11-23-2007
    Posts
    12
    Can any1 please help with this?

    Thanks

  3. #3
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481
    What about the spreadsheet do you want to reflect the update date? Windows should automatically keep track of information such as date created, date modified, and date accessed. Just look in the File menu under Properties.

    If you want the date to appear on the spreadsheet with the current date you could simply put a function into a cell which will return today's date such as
    =Today()

    HTH

  4. #4
    Registered User
    Join Date
    11-23-2007
    Posts
    12

    Almost there!

    Hi

    I have the macro set up so it should show when a spreadsheet was last modified by using the following;

    Sub DateLastModified()
    Dim fs, f
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile("T:\Jobs\Job Loading\Manual Job Loading\Job Board Brands\CareerStructure.com\Weekly Task Spreadsheet.xls")
    Cells(2, 1) = f.DateLastModified
    End Sub


    and i have the auto run feature of;

    Private Sub Workbook_Open()
    Run "DateLastModified"
    End Sub


    However, when the spreadsheet is opened it gives me the date of when i'm opening the document and not when it was last saved by someone else who has just used it?

    Can any1 please help!

    Thanks

    Mike

  5. #5
    Forum Contributor EdMac's Avatar
    Join Date
    01-23-2006
    Location
    Exeter, UK
    MS-Off Ver
    2003
    Posts
    1,264
    If the macro was to run on workbook close, that would tell you when it was last closed.

    Ed

  6. #6
    Registered User
    Join Date
    11-23-2007
    Posts
    12
    is it possible to have tell me when it was last saved or edited by someone else and not the time when i open the spreadsheet?

    Thanks

    Mike

  7. #7
    Forum Contributor EdMac's Avatar
    Join Date
    01-23-2006
    Location
    Exeter, UK
    MS-Off Ver
    2003
    Posts
    1,264
    I'm no VB wizard but have you tried this?

    Private Sub Workbook_close()
    Run "DateLastModified"
    End Sub
    When the book is closed the code runs and enters the date. When you open it, you can see when it was last closed. If you added a bit more code you could also have the user name of the last who closed it.

    Ed

+ 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