- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
·PÁÂc_c_lai¤j¤jªº¼ö¤ß¸Ô²Ó¸Ñ»¡ ¾Ç²ß¤F¸Ñ¨Ç¤F
¦A½Ð°Ý c_c_lai ¤j¤j §Y®É¤ñ¹ïªºO/H/L/C n¦p¦ó«ü©w¼È¦s ...
mead µoªí©ó 2012-5-26 11:57
¨Ì§A¥Ø«eªº»Ý¨D¨Ó»¡¡An¥H¦hªÅ¤O¹D¡B¤Ï¦V¶Õ¤O¡B¥D¤O±±½Lªº¸ê®Æ¦C¨Ó³B²zªº¸Ü¡A
¬O¦³Ãø«×¡A¦Ó¥B§Ú¥»¨¬O¤£°µ³o»ò³B¸Ìªº¡C
¤@¯ë±`¨£ªº¦h¥H¦¨¥æ»ù¬°¥D¹Ï¡B¦¨¥æ¶q¡B¦hªÅ¤O¹D¡B¤Ï¦V¶Õ¤Oµ¥¬°ªþ¹Ï¡C
¤]´N¬O»¡¦h¥H K ½uªº O/H/L/C ¨Ó³B²zªÑ»ù¹Ï¡A¥H§é½u¡B¬Wª¬¹Ï¨Ó»²§Uªþ¹Ï¡C
¦Ó¥B§A¥Ø«eªº¦hªÅ¤O¹D¡B¤Ï¦V¶Õ¤O¡B¥D¤O±±½Lªº¼Æ¾Ú§¡¦³¥¿t¼Æ¡A§Ú¨S¸Õ¹L
ªÑ»ù¹Ï¯à§_³B²z¦¹¥¿tȪº¼Æ¦C¡C§A¥i¥H¸Õ¸Õ¬Ý¡A¤èªk¦p¤U¡G
(1) °²³]§A³]©w¨C¹j 30 ¬í³B²z¸ê®Æ¤@µ§¡C (§Ú¤§«eªþ¤Wªº½d¨Ò§Y¬O)
(2) °²³]§A³]©wBCDEÄæ¦ì¬°¦hªÅ¤O¹D¤§O/H/L/C¡AFGHIÄæ¦ì¬°¤Ï¦V¶Õ¤O¤§O/H/L/C¡AJKLMÄæ¦ì¬°¥D¤O±±½L¤§O/H/L/C¡C
(3) §Ú¤§«eªþ¤Wªº½d¨Ò¥[¥Hק令§Anªº (·Q¤F·QÁÙ¬OÀ°§A§¹¦¨§a¡I)¡G- Option Explicit
- Dim timerEnabled As Boolean '
- Dim counter As Single ' ¥Ü½d¥Îp¼Æ¾¹
- Dim Ov(1 To 3), Hv(1 To 3), Lv(1 To 3), Cv(1 To 3) As Single ' ¶}½L»ù¡B³Ì°ª»ù¡B³Ì°ª»ù¡B¦¬½L»ù(¦¨¥æ»ù) µ¥³]©w¤§ÅܼơC
- ' §ï¥H°}¦C³B²z¡C(1. ¦hªÅ¤O¹D¡B2. ¤Ï¦V¶Õ¤O¡B3. ¥D¤O±±½L)
- Dim turnKey As Integer ' §PÂ_¨C¤@½ü°j¤W¦CÅܼƪì©lȤ§³]©w¡C
- Dim nums As Integer ' ±N¨C¹j "¦h¤Ö®É¶¡" ³B²z®É¬q¡A²¾¨ì¦¹³B¨Ó³B²z¡C
- Private Sub Workbook_Open()
- counter = 0
- nums = 30 ' ³]©w¨C¹j 30 ¬í³B²z®É¬q¡A¥ç¥i§ó§ï¦¨ 10 (¨C¹j 10 ¬í)¡B20 (¨C¹j 20 ¬í)µ¥µ¥¡C
- ' ¦¹³B¤£«Øij¨Ï¥Î 1 ¬í®É¬q¨Ó³B²z¡A¦]¬°ÁÙn¥h¨D¥X¶}½L¡B³Ì°ª¡B³Ì§C¡B¦¨¥æ»ù¡C
- timerEnabled = False
- Call timerStart ' µ{¦¡¤@±Ò©l¡A«K¥h¦Û°Ê°õ¦æ timerStart
- End Sub
- Sub Timer()
- Dim str As String
-
- If (TimeValue(Now) >= TimeValue("08:45:00") And TimeValue(Now) <= TimeValue("13:46:01")) Then ' ¶}½L¡B¦¬½L®É¬q³]©w
- ' ½L¤¤³B²z¡A±N¸ê®Æ¶×¤J¼g¤J¤u§@ªí³æ¤ºÀx¦s¡C
- With Sheets("µ¦²¤°O¿ý")
- .Cells(4, 2) = .Cells(4, 2) + 1 '±NÅܰʦ渹¥[¤@¦æ
- Pos = .Cells(4, 2)
- .Cells(Pos, 1) = Time
- .Cells(Pos, 2) = Ov(1) ' B Äæ
- .Cells(Pos, 3) = Hv(1) ' C Äæ
- .Cells(Pos, 4) = Lv(1) ' D Äæ
- .Cells(Pos, 5) = Cv(1) ' E Äæ
- .Cells(Pos, 6) = Ov(2) ' F Äæ
- .Cells(Pos, 7) = Hv(2) ' G Äæ
- .Cells(Pos, 8) = Lv(2) ' H Äæ
- .Cells(Pos, 9) = Cv(2) ' I Äæ
- .Cells(Pos, 10) = Ov(3) ' J Äæ
- .Cells(Pos, 11) = Hv(3) ' K Äæ
- .Cells(Pos, 12) = Lv(3) ' L Äæ
- .Cells(Pos, 13) = Cv(3) ' M Äæ
- End With
- End If
- End Sub
- Sub ExeSelf()
- timerEnabled = True
- If IsError(Sheets("µ¦²¤°O¿ý").Range("B2").Value) Then ' °²³] B2 Äæ¦ì¬°¦hªÅ¤O¹D
- Cv(1) = 0
- Cv(2) = 0
- Cv(3) = 0
- Else
- Cv(1) = Sheets("µ¦²¤°O¿ý").Range("B2").Value ' ¦hªÅ¤O¹D¦¨¥æ»ù
- Cv(2) = Sheets("µ¦²¤°O¿ý").Range("C2").Value ' ¤Ï¦V¶Õ¤O¦¨¥æ»ù
- Cv(3) = Sheets("µ¦²¤°O¿ý").Range("D2").Value ' ¥D¤O±±½L¦¨¥æ»ù
- End If
-
- If (turnKey = 0 Or Ov(1) = 0) Then ' ·í turnKey Ȭ°0¡Aªí¥Ü¨ä¬°ªì©lȳ]©w¡C¬°¦Ò¶q¨t²Îè³s¤W DDE¡A
- ' ¦³®É¦b²Ä¤@®Ú¼ÆȲ£¥Í®É Ov = Cv È¥i¯à¬° 0 (IsError()ªºª¬ºA)¡C
- Ov(1) = Cv(1) ' ¦hªÅ¤O¹D¶}½L»ùªì©lȳ]©w
- Hv(1) = Cv(1) ' ¦hªÅ¤O¹D³Ì°ª»ùªì©lȳ]©w
- Lv(1) = Cv(1) ' ¦hªÅ¤O¹D³Ì§C»ùªì©lȳ]©w
- Ov(2) = Cv(2) ' ¤Ï¦V¶Õ¤O¶}½L»ùªì©lȳ]©w
- Hv(2) = Cv(2) ' ¤Ï¦V¶Õ¤O³Ì°ª»ùªì©lȳ]©w
- Lv(2) = Cv(2) ' ¤Ï¦V¶Õ¤O³Ì§C»ùªì©lȳ]©w
- Ov(3) = Cv(3) ' ¥D¤O±±½L¶}½L»ùªì©lȳ]©w
- Hv(3) = Cv(3) ' ¥D¤O±±½L³Ì°ª»ùªì©lȳ]©w
- Lv(3) = Cv(3) ' ¥D¤O±±½L³Ì§C»ùªì©lȳ]©w
- End If
-
- turnKey = turnKey + 1
-
- If (Cv(1) > Hv(1)) Then Hv(1) = Cv(1) ' §PÂ_¦hªÅ¤O¹D³Ì°ª»ù
- If (Cv(2) > Hv(2)) Then Hv(2) = Cv(2) ' §PÂ_¤Ï¦V¶Õ¤O³Ì°ª»ù
- If (Cv(3) > Hv(3)) Then Hv(3) = Cv(3) ' §PÂ_¥D¤O±±½L³Ì°ª»ù
- If (Cv(1) < Lv(1)) Then Lv(1) = Cv(1) ' §PÂ_¦hªÅ¤O¹D³Ì§C»ù
- If (Cv(2) < Lv(2)) Then Lv(1) = Cv(2) ' §PÂ_¤Ï¦V¶Õ¤O³Ì§C»ù
- If (Cv(3) < Lv(3)) Then Lv(1) = Cv(3) ' §PÂ_¥D¤O±±½L³Ì§C»ù
- If (turnKey < nums) Then
- Application.OnTime (Now + TimeValue("00:00:01")), "ThisWorkbook.ExeSelf"
- Else
- If (Cv(1) > 0) Then Call Timer
- Call timerStart
- End If
- End Sub
- Sub timerStart()
- turnKey = 0 ' ¨C¤@½ü°j½L¤¤ªì©lȤ§³]©w¡C
- If timerEnabled Then
- Application.OnTime (Now), "ThisWorkbook.ExeSelf"
- Else
- ' ¨t²Îè³s¤W DDE ¦Ü¸ê®Æ¶×¤JExcel¤u§@ªí³æ¡A¶·¦³¤@Ó½w½Ä®É¬q¡A³o®É¦pªG°¨¤W¥h§ì¨úDDE¸ê®Æ¡A·|¦³«¬ºA¤£²Åªº¿ù»~°T®§²£¥Í¡A¨Ã¤¤Â_°õ¦æ§Çªº§@·~¡C
- Application.OnTime (Now + TimeValue("00:00:05")), "ThisWorkbook.ExeSelf"
- End If
- End Sub
½Æ»s¥N½X (4) ¦pªG¦³¤F O/H/L/C «á¡A§A´N·ÓµÛ§Ú³Ì¥ý§i¶D§AªºªÑ»ù¹Ï»s§@¤èªk¡A¤@¤Á«K¤j¥\§i¦¨¤F¡I
(5) ¥¿¦p§Ú¦b«e±»¡¹Lªº¡G§Ú¨S¸Õ¹LªÑ»ù¹Ï¯à§_³B²z¦¹¥¿tȪº¼Æ¦C¡A§A¥i¥H¸Õ¸Õ¬Ý¡C
³o¨à§Ú¥u¬O±Ð§A«ç»ò³B²z¤H¤u²£¥Í¤§ O/H/L/C ªºÂ¬ªù¦Ó¤w¡I |
|