- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 1# handsometrowa - Option Explicit
- Dim T1 As Date
- Const ¶}©l = "08:45:05"
- Const µ²§ô = "13:46:08"
- Const ¶g´Á1 = "12:00:10 AM"
- '******************************
- '±`¼Æ¥iª½±µ³]¬°®É¶¡
- 'Const ¶}©l = #8:45:05 AM#
- 'Const µ²§ô = #1:46:08 PM#
- 'Const ¶g´Á1 = #12:00:10 AM# '10¤ÀÄÁ
- '***************************
- Sub start()
- Call StopTimer
- Call Timer1
- End Sub
- Sub StopTimer()
- On Error Resume Next
- Application.OnTime T1, "Timer1", , 0
- T1 = Now
- '************************
- '«Øij§ï¬° Time(®É¶¡)
- 'T1 = Time
- '***********************
- End Sub
- Sub Timer1()
- '*********************
- '¨Ì§Ç¥u°õ¦æ³Ì¥ý¦¨¥ßªº±ø¥ó,¦p«á±¦³¦¨¥ßªº±ø¥ó¬O¤£·|°õ¦æªº.
- 'If ±ø¥ó=True Then
- ' °õ¦æµ{¦¡½X
- 'ElseIf ±ø¥ó=True Then
- ' °õ¦æµ{¦¡½X
- 'Else '©Ò¦³±ø¥ó³£¤£¦¨¥ß
- ' °õ¦æµ{¦¡½X
- 'End If
- '**********************
- If T1 Then ' T1> 0 -> T1 = True ,T1= 0 -> T1= False
- Sheets("¥x«ü").Range("B6000").End(xlUp).Offset(1, 0) = Sheets("sheet1").Range("B2")
- Sheets("¹q«ü").Range("B6000").End(xlUp).Offset(1, 0) = Sheets("sheet1").Range("B4")
- Sheets("ª÷«ü").Range("B6000").End(xlUp).Offset(1, 0) = Sheets("sheet1").Range("B6")
- End If
- '******************
- 'T1 =¨ç¼Æ(°Ñ¼Æ1,°Ñ¼Æ2,°Ñ¼Æ3,°Ñ¼Æ4)¶Ç¦^ªº¼ÆÈ
- '******************
- T1 = TimeNext(¶}©l, µ²§ô, ¶g´Á1, Now) '«Øij Now (¤é´Á+®É¶¡) §ï¬° Time (®É¶¡)
- If T1 Then Application.OnTime T1, "Timer1"
- End Sub
- Function ATimeNext(TStart As String, TEnd As String, TFrequency As String, TNOW As Date)
- 'Int(TNOW)->¥h±¼¤p¼Æ(®É¶¡) ¶Ç¦^¤é´Á
- If TNOW < Int(TNOW) + TimeValue(TStart) Then 'TNOW > ¤é´Á+®É¶¡
- TimeNext = Int(TNOW) + TimeValue(TStart)
- ' imeNext > ¤é´Á+®É¶¡
- ElseIf TNOW >= Int(TNOW) + TimeValue(TEnd) Then
- TimeNext = 0
- Else
- TimeNext = Int((TNOW + TimeValue(TFrequency) + 0.5 / 86400) / TimeValue(TFrequency)) * TimeValue(TFrequency)
- '86400¬í = 24(¤p®É) * 60(¤ÀÄÁ) * 60(¬í)
- End If
- End Function
- '***********************************************
- '±`¼Æª½±µ³]¬°®É¶¡ 'TNOW §ï¬° Time(®É¶¡)
- 'T1 = TimeNext(¶}©l, µ²§ô, ¶g´Á1, Time)
- '¨ç¼Æ°Ñ¼Æªº«¬ºA¶·×§ï
- Function TimeNext(TStart As Date, TEnd As Date, TFrequency As Date, TNOW As Date) '§ï¬° Time(®É¶¡)
- If TNOW < TStart Then
- TimeNext = TStart
- ElseIf TNOW >= TEnd Then
- TimeNext = 0
- Else
- TimeNext = Time + TFrequency
- End If
- End Function
- '***********************************************
½Æ»s¥N½X |
|