Want to do a function, click the button once, in the A1 record the current system time, to the exact millisecond. Click the button again at the A2 display, and so on!
For example: This function can be used to do lyrics time!
SubTTT () activecell.selecttt=Timerh=Int(TT/3600) M=Int(TT-3600* h)/ -) s=Int(Tt-h *3600-M * -) SS= Left(TT-Int(TT),4) selection.numberformatlocal="YYYY-MM-DD hh:mm:ss.000"Selection.value= h &":"& M &":"& S &Ssactivecell.offset (1,0). SelectEnd Sub
The above code can actually implement this function, but there is a problem, when more than one screen, point, Button Point, Excel View with the Click Button new content screen down, the button can not see, you can not change the position of the cursor. So I improved the following code again:
Subtesttime ()DimTT, NTT=Timern= Range ("A65536"). End (Xlup). ROWH=Int(TT/3600) M=Int(TT-3600* h)/ -) s=Int(Tt-h *3600-M * -) SS= Left(TT-Int(TT),4) Cells (n+1,1). NumberFormatLocal ="hh:mm:ss.000"Cells (n+1,1) = h &":"& M &":"& S &SSEnd Sub
This method can perfectly record the time of the lyrics.
Reference Source: http://www.excelpx.com/thread-329989-1-1.html
VBA records the current system time and is accurate to milliseconds