ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

¦p¦ó ´ú¸Õ Excel VBA ­pºâ®É¶¡¶¡¹jªº ºë½T«×¡H

¦p¦ó ´ú¸Õ Excel VBA ­pºâ®É¶¡¶¡¹jªº ºë½T«×¡H

¥ý¥á¥X ¤@­Ó°ÝÃD¡A¦AºCºC ¸Ñµª
§Æ±æ¤j®a¦³¿³½ì
¤Ñ¤U¬°¤½

  1. Sub main()
  2.    Dim no, i, t1, t2 As Long
  3.    Dim sum, dt As Double
  4.    
  5.    no = 100000000
  6.    ct = 0
  7.    
  8.    While (no > 1)
  9.       ct = ct + 1
  10.       
  11.       t1 = time1()
  12.       sum = 0#
  13.       For i = 1 To no
  14.          sum = sum + i
  15.       Next i
  16.       dt = time2(t1)
  17.       
  18.       Cells(ct, 1) = no
  19.       Cells(ct, 2) = dt
  20.       
  21.       no = no / 3
  22.    Wend
  23. End Sub

  24. Function time1() As Long
  25.    Dim a As Double

  26.    a = Timer * 1000
  27.    time1 = Int(a + 0.5)
  28. End Function

  29. Function time2(ByVal t1 As Long) As Double
  30.    Dim t2 As Long
  31.    Dim dt As Double
  32.    t2 = time1()
  33.    dt = (t2 - t1) / 1000#
  34.    
  35.    ' dt must >- 0.0
  36.    If (dt < 0#) Then
  37.       dt = dt + 86400#
  38.    End If
  39.    
  40.    time2 = dt
  41. End Function
½Æ»s¥N½X
¦^´_ 1# sjgau
¤Ñ¤U¬°¤½

TOP

¦^´_ 2# sjgau
§Úı±o³o¼Ë¦³°ÝÃD¡ATimer¶Ç¦^ªº¼Æ¬°Single¡A
¦b§Úªº¹q¸£¤W¡ATimer¶Ç¦^ªº¼Æ¥u·|¨ì¤p¼ÆÂI«á²Ä¤G¦ì¡A
³o­Ó¼Æ¬O¤w¸g¶i¦ì¹Lªº¡A¦Ó¤£¸Ó¦A¥Î timer1( ) °µ¥|±Ë¤­¤J¡A

§A¥i¯à·|»¡¡ATimer¶Ç¦^ªº¼Æ¦pªG¥u¨ì¤p¼ÆÂI«á²Ä¤G¦ì¡Atimer1( )¸Ìªº a ¤p¼ÆÂI«á´NÀ³¸Ó³£¬O¹s¡A¥i¬O¤£¬O³o¼Ë¡C

³o¬O¦]¬°§Aªº a ¬O Double ¸ê®Æ«¬ºA¡A¸ê®Æ«¬ºA¤§¶¡Âà´«³y¦¨ªº»~®t¡A¥i run ©³¤Uµ{¦¡½Xª¾¹D¦³¦¹»~®t¡G
  1. Sub Test()
  2.   Dim t1 As Single
  3.   Dim d1 As Double
  4.   
  5.   t1 = Timer
  6.   Debug.Print "t1=", t1
  7.   Debug.Print "Cdbl(t1)=", CDbl(t1)
  8.   d1 = t1
  9.   Debug.Print "d1=", d1
  10. End Sub
½Æ»s¥N½X

TOP

¦^´_ 3# stillfish00


    ¦P·N ±zªº¬Ýªk¡A
SINGLE ªº ºë½T«×¡A¥u¦³ 6 - 7¦ì¼Æ¡A
©Ò¥H¡A¥H¤Wªº´ú¸Õ ½T¹ê¤£¤Ó ¬ì¾Ç
¤Ñ¤U¬°¤½

TOP

¦^´_ 3# stillfish00

Timer ¨ç¼Æ
½Ð°Ñ¾\     ½d¨Ò     ¯S©Ê

¶Ç¦^¤@ Single¡A¨ä¤º®e¬°±q«e¤@­Ó¤È©]ºâ°_¨ì²{¦b©Ò¸g¹Lªº¬í¼Æ¡C

»yªk

Timer

½Ðª`·N

¦b Microsoft Windows¤¤¡A Timer¨ç¼Æ¶Ç¦^¤@¬íªº¤p¼Æ³¡¤À¡C
¤Ñ¤U¬°¤½

TOP

        ÀR«ä¦Û¦b : ¤f»¡¤@¥y¦n¸Ü¡A¦p¤f¥X½¬ªá¡F¤f»¡¤@¥yÃa¸Ü¦p¤f¦R¬r³D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD