Using VBA, how to display seconds decimals using format and now functions?

NeuroSpace

New member
Joined
Feb 1, 2014
Messages
1
Reaction score
0
Points
0
Hello everyone!

I am using the following VBA macro, which inputs timestamps every time a key combination (alt+right arrow in this case) is pressed:
Sub AltRight_Sub()
On Error Resume Next
Cancel = True
Cells(Rows.Count, 2).End(xlUp).Offset(1) = Format(Now, "HH:MM:SS")
End Sub

I would like this to display decimal seconds as well. Is there a quick change I can make to the formatting of "HH:MM:SS" which will work?

So far I've tried "HH:MM:SS.0" and similar variations, which only appends to the seconds whatever follows the period; and "HH:MM:SS:MS" and similar variations, but that only redisplays the minute and second values.

I am using Excel 2011 on Mac OS 10.9.1

Thanks!
 

NoS

New member
Joined
Jan 17, 2013
Messages
832
Reaction score
0
Points
0
Location
British Columbia
Excel Version(s)
Excel 2010
NeuroSpace

Nobody need give their time towards a solution for your problem if it's already been solved.

Please, if you're going to cross post, do it properly.

Numerous forums refer to this http://www.excelguru.ca/content.php?184 for an understanding of why.



http://www.mrexcel.com/forum/excel-...iseconds-visual-basic-applications-macro.html
http://www.excelforum.com/excel-pro...l-seconds-using-format-and-now-functions.html
http://www.excelguru.ca/forums/show...conds-decimals-using-format-and-now-functions

Any others?
 
Top