返回列表 上一主題 發帖

如何取得EXCEL 時間,單位到毫秒

如何取得EXCEL 時間,單位到毫秒

下述片段功能是A列只要輸入資料,B列會自動帶出系統時間

Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.Count > 1 Then Exit Sub
     Select Case Target.Row
        Case 60000: Target(-59998, 2).Select
     End Select
   If Target.Column = 1 Then
      Target.Offset(0, 1) = Now
   End If
End Sub

儲存格格式設成 yyyy/m/d hh:mm:ss.000 ,得到的日期時間是這樣 
2016/6/4 14:42:10.000
2016/6/4 14:42:11.000
2016/6/4 14:42:12.000

如何才能取得毫秒?
謝謝~

GetSystemTime

TOP

http://blog.xuite.net/hcm19522/twblog/419610391
參考 ~

TOP

謝謝協助,我用以下的程式解決此問題,給有需要的人參考參考~
Public Function TimeInMS() As String
TimeInMS = Strings.Format(Now, "dd-MMM-yyyy HH:nn:ss") & "." & Strings.Right(Strings.Format(Timer, "#0.00"), 2)
End Function

TOP

        靜思自在 : 不要隨心所欲,要隨心教育自己。
返回列表 上一主題