AutoHotKey
엑셀 현재시간삽입 단축키 초단위로 입력
쵸코난
2025. 6. 9. 10:56

=Now 수식은 파일을 열 때마다, 계산이 발생할 때마다 현재시간으로 달라지게 됩니다.
변하지 않는 셀값으로 넣으면서 초단위까지 서식을 지정하려면 아래와 같은 VBA로 가능합니다.
Sub insertCurrentTime()
With ActiveCell
'.NumberFormat = "h:mm:ss AM/PM"
.NumberFormat = "hh:mm:ss"
.Value = Format(Now, "hh:mm:ss")
'.Columns.AutoFit '셀 넓이 자동 조절
End With
End Sub
빠른 실행에 추가하고 Alt+숫자키로 실행할 수 있습니다.
단, 엑셀 매크로 파일이 열려 있어야 합니다.
항상 실행하고 싶다면 추가기능으로 만들거나
Autohotkey 로 만드는 방법이 있습니다.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
WinSetTitle, InsertTime
;msgbox ,0x40, InsertTime, Hit <Ctrl+Shift+;> to insert the current time(hh:mm:ss) in the active cell.`n`nHit [Win+X] to quit this script
msgbox ,0x40, InsertTime, 단축키 <Ctrl+Shift+;> 또는 <F3>을 누르면 현재시간(hh:mm:ss)을 현재 셀에 입력합니다.`n`n[Win+X]를 누르면 종료합니다.
if (%A_IsCompiled%) {
Menu, Tray, Icon, %A_ScriptName%, 1
}
Menu, Tray, NoStandard
Menu , Tray, Add, Exit, ExitMenu
return
#IfWinActive, ahk_class XLMAIN
~F3::
^+;::
try {
xapp := ComObjActive("Excel.Application")
xapp.ActiveCell.NumberFormat := "hh:mm:ss"
FormatTime str, , hh:mm:ss
xapp.ActiveCell.Value := str
;xapp.ActiveCell.Columns.AutoFit ;셀 넓이 자동 조절
}
catch e {
;no Excel
}
return
ExitMenu:
#x::
exitapp
첨부한 실행파일(InsertTime1.exe)을 실행한 상태에서 원래 단축키인 <Ctrl+Shit+;> 나 <F3>을 누르면
현재 셀에 10:11:34 처럼 현재 시간이 입력됩니다.

MS스토어의 시간 삽입하는 추가기능들은 현재 작동하지 않네요.
그밖에 Xltools 같은 추가기능도 있습니다.
참고: 지식인