ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Date and Time Macro (https://www.excelbanter.com/excel-discussion-misc-queries/889-date-time-macro.html)

m.j.anderson

Date and Time Macro
 
I would like to create a macro (or add a button to the toolbar) that will
insert todays date and time into a selected cell. (word does this nicely and
gives the option to automatically update or to remain static- - I need static
dates with an easy way for multiple users to insert them ) The =TODAY
function will insert the date but not the time and the =NOW function updates
all cells with "now" dates to the most recently inserted. The date and time
will be used to track info in adjacent cells. The date needs to remain static
so that users can see dates and times that the info was added.
new to macros/ keep it simple
THANKS!

Andy Brown

Start recording a macro. In the "Record Macro" dialog, change the macro name
to "Date_Time" (without the quotes), make the shortcut key CTRL+T (capital
T), make sure it's stored in This Workbook, click OK.

Stop Recording.

Press ALT+F8, highlight Date_Time in the listbox, click Edit. Replace
everything between the "Sub" and "End Sub" lines with

ActiveCell.Value = Now

Press ALT+Q to quit the VBE. Back in the worksheet, use the CTRL(+Shift)+T
shortcut to call it.

HTH,
Andy




All times are GMT +1. The time now is 09:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com