Adding Date and Time to an Excel worksheet by one click Excel ( macro )

The fol­low­ing macro will enter the cur­rent date and time in the active cell with­out mov­ing the cur­sor. The date and time will be entered as a dat­e­val­ue, mean­ing 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 ALTF11
Insert > Module
Paste the macro into the Mod­ule area to the right

3,Close the VBE and return to Excel
4,Click Tools > Macro > Macros
Click ‘Options’

Enter the let­ter you wish to use as a key­board shortcut.
I usu­al­ly use ‘a’ because it is close to the Ctrl key.
Close back to Excel

Now, when you press Ctrl + a (or what­ev­er let­ter you chose)
the date and time will be insert­ed into the activecell.

Note: if you want the date and time to be auto­mat­i­cal­ly entered into a spe­cif­ic cell when you open the work­book, let me know and I will amend the macro.

SOURCE

LINK INTEREST
Date with my sheet – 10 tips on using date / time in excel
http://chandoo.org/wp/2008/07/29/excel-keyboard-shortcuts/
http://office.microsoft.com/en-us/excel-help/keyboard-shortcuts-in-excel-HA102772370.aspx

Face­book Comments