I use this VBA:
ActiveCell.FormulaR1C1 = "=NOW()"
ActiveCell.Offset(1, 0).Range("A1").Select
But the value of the cell becomes =NOW()
, not the date.
I want to push the button and get 2015-03-13, and when I open the sheet tomorrow, it should still say 2015-03-13.
Maybe you should consider:
Ctrl+:
Your code ActiveCell.FormulaR1C1 = "=NOW()"
is absolutely perfect. It works correctly on my System. You not need to till
tomorrow to check the output of this code, first write this code and run macro and save and close it (please check the date). After closing the file change your system date i.e suppose today is 13-Mar then set the 14-Mar date of your system timing then open the file , you will observer the date in is change.
you can write this Thisworkbook in open workbook event.
Private Sub Workbook_Open()
ActiveCell.FormulaR1C1 = "=NOW()"
End Sub
Private Sub Workbook_Open()
ActiveCell.Value = Now
End Sub