The following macro will enter the current date and time in the active cell without moving the cursor. The date and time will be entered as a datevalue, meaning that it will not change every time you open the workbook.
1,Open your workbook
Copy this macro to the clipboard
Sub Set_DateTime() ActiveCell.Value = Format(Now(), "h:mm:ss") End Sub
2,Next press ALT + F11
Insert > Module
Paste the macro into the Module area to the right
3,Close the VBE and return to Excel
4,Click Tools > Macro > Macros
Enter the letter you wish to use as a keyboard shortcut.
I usually use ‘a’ because it is close to the Ctrl key.
Close back to Excel
Now, when you press Ctrl + a (or whatever letter you chose)
the date and time will be inserted into the activecell.
Note: if you want the date and time to be automatically entered into a specific cell when you open the workbook, let me know and I will amend the macro.
Date with my sheet – 10 tips on using date / time in excel