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

½Ð°Ý¡A¯S©w®É¶¡°õ¦æµ{¦¡ªºµ{¦¡½X¡A­n¦p¦ó§ï?

½Ð°Ý¡A¯S©w®É¶¡°õ¦æµ{¦¡ªºµ{¦¡½X¡A­n¦p¦ó§ï?

Dim I As Integer '(µu¾ã¼Æ)¸ê®Æ«¬ºA'Public i As interger => ¥X²{¨Ï¥ÎªÌ«¬ºA©|¥¼©w¸q, ¥¿½T: Integer

Sub Ex()
    Dim xTime As Date
    If Time >= #8:45:00 AM# And Time <= #1:30:00 PM# Then
        With Sheets("RTD").Cells(I + 3, "T").Resize(, 6)
            .Offset(-2).Value = .Offset(-2).Value '¤W¤@¦C:±N¤½¦¡¦^¼Æ­È
                    'TÄ椽¦¡=IF(ISERROR(MATCH(U2,P:P,0)),"",MATCH(U2,P:P,0))
            .Range("A1") = "=MATCH(RC[1],R3C[-19]:R70000C[-19],1)+2"
                    'XÄ椽¦¡=IF(W2="","",IF(W2>54,-1,IF(W2<6,1,"")))
            .Range("E1") = "=SUM(INDIRECT(""B""&R[-1]C[-4]+1):INDIRECT(""B""&RC[-4]))"
                    'YÄ椽¦¡=IF(ISERROR(INDIRECT("R"&T2)),Y1,INDIRECT("R"&T2))
            .Range("F1") = "=SUM(INDIRECT(""C""&R[-1]C[-5]+1):INDIRECT(""C""&RC[-5]))"
                    'WÄ椽¦¡=IF(ISERROR(INDIRECT("O"&T2)),"",INDIRECT("O"&T2))
            .Range("C1") = "=RC[-2]-R[-1]C[-2]"
                    'XÄ椽¦¡=IF(W2="","",IF(W2>54,-1,IF(W2<6,1,"")))
            '.Range("E1") = "=IF(RC[-1]="""","""",IF(RC[-1]>54,-1,IF(RC[-1]<6,1,"""")))"
                    'YÄ椽¦¡=IF(ISERROR(INDIRECT("R"&T2)),Y1,INDIRECT("R"&T2))
            '.Range("F1") = "=IF(ISERROR(INDIRECT(""R""&RC[-5])),R[-1]C,INDIRECT(""R""&RC[-5]))"
            '.Resize(, 6) = .Resize(, 6).Value  '±N¤½¦¡¦^¼Æ­È
        End With
        I = I + 1
        xTime = Time + #12:01:00 AM#
        If xTime <= #1:45:00 PM# Then Application.OnTime xTime, "EX"
    ElseIf Time < #8:45:00 AM# Then
        Application.OnTime #8:45:00 AM#, "EX"
    Else
        MsgBox "®É¶¡¤w¹L"
    End If
End Sub

¤W­±¬O§Ú¥Ø«e¦b°õ¦æµ{¦¡ªºµ{¦¡½X¡A½Ð°Ý¤@¤Uª©¤W«e½ú¡A¦pªG­n±N¤W­zµ{¦¡½X§ï¦¨¤@¼Ë¦b8:45-13:45¤À°õ¦æ¡A¦ý°õ¦æ±ø¥ó§ï¬°¨C¤ÀÄÁªº¬í¼Æ¨ì57¬í°õ¦æµ{¦¡¡A¨ì¤U¤ÀÄÁªº01¬í±N¤W¤@­Ó°õ¦æªº¤½¦¡¼g¦¨­È¡A³o¼Ë­n¦p¦ó§ó§ïµ{¦¡½X©O?

¨Ò¡F8:45:57¬í°õ¦æ¥H¤U¥\¯à¡A8:46:01¬í±N8:45:57¬í°õ¦æªº¤½¦¡Âন­È¡A8:46:57¬í¤@¼Ë°õ¦æµ{¦¡¡A8:47:01¬í¤@¼ËÂà´«¦¨­È¡A¨Ì¦¹Ãþ±À¡A¤@ª½°õ¦æ¨ì13:45¡A³o¼Ëªºµ{¦¡½X­n¦p¦ó§ó§ï?
             .Range("A1") = "=MATCH(RC[1],R3C[-19]:R70000C[-19],1)+2"
                    'XÄ椽¦¡=IF(W2="","",IF(W2>54,-1,IF(W2<6,1,"")))
            .Range("E1") = "=SUM(INDIRECT(""B""&R[-1]C[-4]+1):INDIRECT(""B""&RC[-4]))"
                    'YÄ椽¦¡=IF(ISERROR(INDIRECT("R"&T2)),Y1,INDIRECT("R"&T2))
            .Range("F1") = "=SUM(INDIRECT(""C""&R[-1]C[-5]+1):INDIRECT(""C""&RC[-5]))"
                    'WÄ椽¦¡=IF(ISERROR(INDIRECT("O"&T2)),"",INDIRECT("O"&T2))
            .Range("C1") = "=RC[-2]-R[-1]C[-2]"
                    'XÄ椽¦¡=IF(W2="","",IF(W2>54,-1,IF(W2<6,1,"")))
            '.Range("E1") = "=IF(RC[-1]="""","""",IF(RC[-1]>54,-1,IF(RC[-1]<6,1,"""")))"
                    'YÄ椽¦¡=IF(ISERROR(INDIRECT("R"&T2)),Y1,INDIRECT("R"&T2))

¥»©«³Ì«á¥Ñ singo1232001 ©ó 2024-4-4 20:48 ½s¿è

¦^´_ 1# ÂŤÑÄR¦À


    Sub test()
          I = TimeValue("08:45:00")  '°_
Do While I <= TimeValue("13:45:00")  '²×
    If Format(I, "ss") = "57" Then   '¬í¼Æ¬°57
    Application.OnTime Date + I, "¤u§@ªí1.·í57¬í®É­n°õ¦æªºµ{§Ç"
    End If
    If Format(I, "ss") = "01" Then   '¬í¼Æ¬°01
    Application.OnTime Date + I, "¤u§@ªí1.·í01¬í®É­n°õ¦æªºµ{§Ç"
    End If
   
    I = DateAdd("s", 1, I)
Loop
End Sub

Sub ·í57¬í®É­n°õ¦æªºµ{§Ç()
       Debug.Print "°õ¦æ57¬íµ{§Ç"
End Sub

Sub ·í01¬í®É­n°õ¦æªºµ{§Ç()
       Debug.Print "°õ¦æ01¬íµ{§Ç"
End Sub

TOP

        ÀR«ä¦Û¦b : ·O´d¨S¦³¼Ä¤H¡A´¼¼z¤£°_·Ð´o¡C
ªð¦^¦Cªí ¤W¤@¥DÃD