Static timestamp in excel

I'd like to be able to add a timestamp at the click of a button to an excel cell. Unfortunately doing =Now() will always update to the current time, and thus is not static.

I could do F5 in notepad, and then transfer it to excel, but i'd rather cut out the middle man.

Thanks.

Answers


Create a button next to a cell.

Then for the VBA code inside of that button's "onclick" event do something like this:

Sheets("Sheetname").Range("C1").value = time()

Or for date & time

Sheets("Sheetname").Range("C1").value = Now()

Either way only when the button is clicked will the value of that cell be set to the current time.

Note:

If you've never inserted a button object into excel here is a step-by-step guide for Excel 2003,2007, and 2010

http://www.excel-vba-easy.com/vba-how-to-create-macro-excel.html#create-macro-excel-2003

Update:

If you only want to add the timestamp to the currently selected cell then use the following line of code:

ActiveCell.value = Now()

You might not really need a button if you just use Ctrl+Shift+: help says Ctrl+: but don't forget to use Shift to get that.


None of the examples I have seen really simply do what is asked. (Note Using Excel 2010)

Here is a simple macro. I saved the worksheet macro enabled and I added a QuickAccess Toolbar button to run it.

Sub MyTimeStamp()
Dim DT
'
' MyTimeStamp Macro
'
' Keyboard Shortcut: Ctrl+t
'

DT = Format(Now, "mm/dd/yyyy hh:mm:ss AM/PM")
ActiveCell.Select
Selection.NumberFormat = "mm/dd/yyyy hh:mm AM/PM"
ActiveCell.Value = DT

End Sub

Need Your Help

modifiy HOST_NAME() in sql server

sql triggers

I have delete trigger on table, in which I use function HOST_NAME() to retrieve user who executed action then I checked that user exists in User table if not then I throw Raiserror. Action is perform

Push notifications for a salesforce iPhone application

iphone ipad salesforce push-notification apple-push-notifications

I am trying to evaluate the ways in which I could implement push notification for a salesforce iPhone app that I am going to create. Options I am going to explore are Urban Airship or Salesforce's