Date/s

  • Thread starter Thread starter Mario Gerada
  • Start date Start date
M

Mario Gerada

today i would like the current date (auto) put into A1.
tomorrow when I come back to my form i would like the
current date (auto) put into A2 without the date in A1
changing. How do I retain the A1 date without it
changing? Hope this makes sense.
 
try this

Sub putdates()
Cells(Cells(65536, "a").End(xlUp).Row + 1, "a") = Date
End Sub
 
Mario,

You might want to put that into an automatic workbook open event

Private Sub Workbook_Open()
Dim cRows As Long
Dim iRow As Long

With Worksheets("Sheet1")
cRows = .Cells(Rows.Count, "A").End(xlUp).Row
If (cRows = 1 And IsEmpty(.Cells(cRows, "A").Value)) Then
iRow = 1
Else
iRow = cRows + 1
End If
With .Cells(cRows, "A")
If .Value <> Date Then
.Cells(2, 1).Value = Date
.NumberFormat = "dd mmm yyyy"
End If
End With
End With

End Sub
 
Back
Top