=HEUTE() vor Schließen - Speichern eintragen
05.03.2017 10:10:48
Andi
Es geht dem Ende zu...
Habe nun mal "bevor die Mappe gespeichert wird" einen Code mit in " diese Arbeitsmappe " geschrieben.
Da ja beim Öffnen abgefragt wird, ob in "E" ein Datum steht, wenn nicht wird das Erstelldatum eingetragen, so soll eben beim Schließen in "E" das heutige Datum eingetragen werden. Beim Bearbeiten bleibt ja die Zelle E leer.
Normal müsste jetzt noch
Format(ThisWorkbook.BuiltinDocumentProperties(11).Value, "DD/MM/YYYY")
gegen =Heute() ersetzt werden.
Option Explicit
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
'Beim Schließen der Mappe wird geprüft ob in "E" ein Wert steht
'Steht da keiner, wird das heutige Datum eingetragen.
Dim dat&
With Tabelle1
For dat = 2 To .Cells(.Rows.Count, 1).End(xlUp).Row
If .Cells(dat, 5).Value = "" Then
.Cells(dat, 5) = Format(ThisWorkbook.BuiltinDocumentProperties(11).Value, "DD/MM/YYYY")
End If
Next
End With
End Sub
Gruß Andi