Sabtu, 07 Mei 2016

Excel : Statik Timestamp dengan detik

Hi!
I need to register events (many...).
I need the time stamp, so I want to use:
To insert the current time, press CTRL+SHIFT+; (semi-colon).
But... It gives me the time in minutes. 
The second are always 0.
How can I do the same but with accuracy of seconds?

answer:


Are you open to using macros?
I hope so 
Here's a short macro that may help if you store it in a normal module of your personal xls(m) file & assign a shortcut key combination to it. Note, I suggest using a different combination than the [CTRL+SHIFT+;] to prevent any for yourself/other users when the seconds aren't required.


Sub Macro7()
'suggested Keyboard Shortcut: Ctrl+Shift+T
    With ActiveCell
        If .Value = "" Then
            .Value = CDate(Now)
'change as necessary
            .NumberFormat = "dd/mm/yyyy hh:mm:ss"
        Else
            MsgBox prompt:="Data in cell therefore the time stamp won't be entered.", Title:="MACRO WARNING"
        End If
    End With
End Sub

Open your file that you want this macro to be available in
press [Alt + F11] (to open the VBA editor)
Insert module from the menubar in the VBA editor
type "Option Explicit" at the top of the code window (should take up most of the screen)
Paste the macro code in there
rename the macro eg " Sub InsertStaticTimeInclSeconds()"
[ctrl + F4] to close the code window
[Alt + Q] to go back to Excel

In Excel press Alt-F8 to get a macro list
select the macro
Press [options] & hold down the [shift] key when entering "T" into the Shortcut Key field.
[ok] out
choose an empty cell & press [ctrl + shift + T] to test the macro

yeey problem solved,.

Sumber:
http://www.excelforum.com/l/707711-insert-a-static-time-with-seconds.html

Tidak ada komentar:

Posting Komentar