- ©«¤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# laieven
¸Õ¸Õ¬Ý- Option Explicit
- Private Sub Worksheet_Calculate()
- Dim StartTime As Date, StopTime As Date
- Dim T(1 To 3) As Double, xMax As Double, xMin As Double
- Dim ¦¨¥æ»ù As Range
- Static Rng As Range, S As Integer
-
- StartTime = Range("A6") '¶}½L®É¶¡, ¨Ò¦p: "09:00:00 AM"
- StopTime = Range("A7") '¦¬½L®É¶¡, ¨Ò¦p: "01:30:00 PM"
- If Time <= StartTime Or Time > StopTime Then '©|¥¼¶}½L ©Î ¤w¸g¦¬½L
- Set Rng = Nothing
- Exit Sub
- End If
- Set ¦¨¥æ»ù = Range("A2")
- '****¤ÀÄÁ³]©w******
- 'T(1) = Application.Text(StartTime, "[M]") '¶}½L®Éªº¤ÀÄÁ¼Æ
- 'T(2) = Application.Text(Time, "[M]") 'Nowªº¤ÀÄÁ¼Æ
- 'T(3) = Round(((T(2) - T(1)) / 5)) '¶}½L«á¨C®É5¤ÀÄÁªº¶¡¹j¦¸¼Æ
-
- '*** ¬í¼Æ³]©w
- T(1) = Application.Text(StartTime, "[S]") '¶}½L®Éªº¬í¼Æ
- T(2) = Application.Text(Time, "[S]") 'Nowªº¬í¼Æ
- T(3) = Round(((T(2) - T(1)) / 10)) '¶}½L«á¨C10¬íªº¶¡¹j¦¸¼Æ
-
- If Rng Is Nothing Then Set Rng = Range("D1").Resize(, 4)
- xMax = Application.Max(Rng) '¾ú¥v³Ì°ª»ù
- xMin = Application.Min(Rng) '¾ú¥v³Ì§C»ù
-
- If S = T(3) Then '³]©wªº®É¶¡¶¡¹j¤º
- If ¦¨¥æ»ù > xMax Then Rng.Cells(1, 2) = ¦¨¥æ»ù '³Ì°ª»ù
- If ¦¨¥æ»ù < xMin Then Rng.Cells(1, 3) = ¦¨¥æ»ù '³Ì°ª»ù
- Rng.Cells(1, 4) = ¦¨¥æ»ù '¦¬½L»ù
- ElseIf S <> T(3) Then
- Set Rng = Rng.Offset(1) '¤U¤@¦C
- Rng.Resize(, 4) = ¦¨¥æ»ù
- Cells(Rng.Row, "c") = Time '¬d¬Ý®É¶¡ªº¶¡¹j,¦p¤£»Ýn¥i§R°£±¼
- End If
- S = T(3)
- End Sub
½Æ»s¥N½X |
|