Inserting dates [SOLVED]

  • I am running on Win NT 4.0 (I think), and using Excel 97.

    I am trying to automatically insert the date a workbook was last changed into the footer of the worksheet. All I can get it to do is display the current date. Any ideas?

  • Can you explain how are you doing that??

    If you go to View->header / footer -> header / footer -> Custom Header,
    it should allow to insert &[date] in there :o

    Did you do something else???

    Thanks: ~Yogendra

  • I think this is what you want

    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    Dim FilePath As String, PrintDate As String
    FilePath = ThisWorkbook.Path & "\" & ThisWorkbook.Name
    PrintDate = FileDateTime(FilePath)
    ActiveSheet.PageSetup.CenterFooter = "File Last modified " & PrintDate
    End Sub

    Will put the file last modified date in centre footer of whatever sheet you print.

    (Im hope VBA is OK)

  • another approach: short and sweet.

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
        ActiveSheet.PageSetup.CenterFooter = Now()
    End Sub

    Thanks: ~Yogendra

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!