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

[µo°Ý] ¦p¦ó§PÂ_ Application.OnTime ¬O§_¦b°õ¦æ??

¦^´_  t8899
   
ÅK©w¤£¬O,­nªþÀɬݬݩάO§¹¾ãµ{¦¡½X
GBKEE µoªí©ó 2014-10-21 15:28

ªþÀÉ Book2.zip (9.55 KB)

TOP

¦^´_ 21# t8899
­×§ï¤@¤U
  1. Option Explicit
  2. Public The_Time As Date
  3. Public my As Date
  4. Sub timestock()
  5.     If CDec(The_Time) > CDec(Time) Then    '¹w¨¾ ¤W¤@¦¸ OnTime©|¥¼°õ¦æ,¦A«×°õ¦æ¤@¦¸OnTime
  6.       '************************
  7.       '·í my <= #12:00:05 AM# ®É
  8.       'If The_Time > Time Then ³o±ø¥ó¦¡±`·|¦¨¥ß
  9.       '¬O¥Ñ©ó The_Time As Date«¬ºA½d³ò¤p
  10.       
  11.       'CDec(The_Time) ¶Ç¦^ Decimal ¸ê®Æ«¬ºA
  12.       'Decimal ¸ê®Æ«¬ºA
  13.       'Decimal ÅܼƫY¥H 96 ¦ì¤¸ ( 12 ­Ó¦ì¤¸²Õ ) ¦³¥¿­t¸¹ªº¾ã¼Æ§Î¦¡¨ÓÀx¦s¡C10 ªº«ü¼Æ¥H¤p¼ÆÂI¥kÃ䪺¦ì¤¸¼Æ¨Ó½Õ¾ã¡A½d³ò±q 0 ¨ì 28¡C¦b¨S¦³¤p¼Æ¦ì¼Æªº±¡§Î¤U¡A³Ì¤jªº¥i¯à­È¬° +/-79,228,162,514,264,337,593,543,950,335¡C¦Ó¦b¦³ 28 ­Ó¤p¼Æ¦ì¸mªº±¡§Î¤U¡A³Ì¤j­È¬° +/-7.9228162514264337593543950335¡A¦Ó³Ì¤pªº«D¹s­È¬° +/-0.0000000000000000000000000001¡C
  14.       'ªþµù ¦¹®É¡ADecimal ¸ê®Æ«¬ºA¥u¯à¦b Variant¤¤¨Ï¥Î
  15.       '¤]´N¬O¡A±z¨Ã¤£¯à«Å§i¤@ÅܼƬ° Decimal ªº«¬ºA¡C¤£¹L±z¥i¥Î Cdec ¨ç¼Æ¡A«Ø¥ß¤@­Ó°Æ«¬ºA¬° Decimal ªº Variant¡C
  16.       '************************
  17.         Debug.Print CDec(The_Time), CDec(Time)
  18.         Exit Sub        
  19.     End If
  20.     With Sheets("sheet1").Range("a1")
  21.         If .Value = 1 Then
  22.             my = #12:01:00 AM#
  23.         ElseIf .Value = 2 Then
  24.             my = #12:02:00 AM#
  25.         ElseIf .Value = 3 Then
  26.             my = #12:00:30 AM#
  27.         ElseIf .Value = 4 Then
  28.             my = #12:00:20 AM#
  29.         ElseIf .Value = 5 Then
  30.             my = #12:00:05 AM#
  31.         ElseIf .Value = 6 Then
  32.             my = #12:00:10 AM#
  33.         Else
  34.             Exit Sub
  35.         End If
  36.     End With
  37.     The_Time = Time + my
  38.     Debug.Print The_Time
  39.     Application.OnTime The_Time, "timestock"
  40. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_  t8899
­×§ï¤@¤U
GBKEE µoªí©ó 2014-10-21 16:50


´ú¸Õ¨S°ÝÃD¤F¡AÁÂÁÂ
30¬í¥Î¨º­Ó¸û¬Ù¸ê·½?
#12:00:30 AM#
TimeSerial(0, 0, 30)
DateAdd("s", 30, Time)

TOP

¦^´_  t8899
­×§ï¤@¤U
GBKEE µoªí©ó 2014-10-21 16:50

©êºp¡A´ú¤[¤@ÂIÁÙ¬O¦³°ÝÃD
¤j¬ù5¤À30¬í ´N¥X¿ù¤F
ªþÀÉ Book2.zip (11.28 KB)

TOP

¦^´_ 24# t8899
´ú¸Õ20¤ÀÄÁ¨S¥X¿ù
   
  1. Option Explicit
  2. Public The_Time As Date
  3. Public my As Date
  4. Sub timestock()
  5. If CDec(The_Time) > CDec(Time) Then    '¹w¨¾ ¤W¤@¦¸ OnTime©|¥¼°õ¦æ,¦A«×°õ¦æ¤@¦¸OnTime
  6.     Range("C65536").End(xlUp).Offset(1) = Time '**** OnTime©|¥¼°õ¦æ®É,¦A«×°õ¦æ¤@¦¸OnTime
  7.     Exit Sub
  8. End If
  9.     If Sheets("sheet1").Range("a1").Value = 1 Then my = #12:01:00 AM#
  10.     If Sheets("sheet1").Range("a1").Value = 2 Then my = #12:02:00 AM#
  11.     If Sheets("sheet1").Range("a1").Value = 3 Then my = #12:00:30 AM#
  12.     If Sheets("sheet1").Range("a1").Value = 4 Then my = #12:00:20 AM#
  13.     If Sheets("sheet1").Range("a1").Value = 5 Then my = #12:00:05 AM#
  14.     If Sheets("sheet1").Range("a1").Value = 6 Then my = #12:00:10 AM#
  15.     Range("a65536").End(xlUp).Offset(1) = Time   '**** °õ¦æªºOnTime
  16.     The_Time = Time + my
  17.     Application.OnTime The_Time, "timestock"
  18.     Range("b65536").End(xlUp).Offset(1) = The_Time '**** °õ¦æ¤U¤@¦¸OnTime
  19.     MsgBoxTest 0, "test", "´£¥Ü°T®§", vbSystemModal, 0, 1000
  20. End Sub
½Æ»s¥N½X

·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_  t8899
´ú¸Õ20¤ÀÄÁ¨S¥X¿ù
GBKEE µoªí©ó 2014-10-22 05:00

¤U¤È¤~·|µo¥Í³oºØ¿ù»~
±z¬O­è´ú¸Õªº¶Ü?²{¦b¦­¤W5:10
³Â·Ð±z¦b±±¨î¥x§â®É¶¡§ï¬°14:00 ¦A¸Õ¸Õ
¸Õ«á¦A½Õ¦^¨Ó
§Ú¬O³o¼Ë¸Õ¥X¨Óªº

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-10-22 16:04 ½s¿è

¦^´_ 26# t8899
½Ð¦b§ï¤@¤U¸Õ¸Õ¬Ý
  1. If TimeValue(The_Time) > Time Then
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_  t8899
½Ð¦b§ï¤@¤U¸Õ¸Õ¬Ý
GBKEE µoªí©ó 2014-10-22 09:50


´ú¸Õ20¤ÀÄÁ¡A¨S¤°°ÝÃD
1.TimeValue(The_Time) ¸ò The_Time ¶Ç¦^³£¬O+30¬íªº­È¦³¦ó¤£¤@¼Ë?,®æ¦¡¤]¨S¤°»ò¤£¦P?
2.¥ú¥Î The_Time ¬°¦ó¨ì¤U¤È´N·|µo¥Í¿ù»~???

TOP

¦^´_ 28# t8899
­n¬ã¨s¤@¤U
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : µÊ®ð¼L¤Ú¤£¦n¡A¤ß¦a¦A¦n¤]¤£¯àºâ¬O¦n¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD