- ©«¤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# ko310kmo - Dim A, B, TheTime As Date, AR, ¶}½L»ù
- Private Sub Worksheet_Calculate()
- Dim E, i%
- On Error GoTo t '³B²z §Y®É¦¨¥æ»ù»P¦¨³æ¶q ½d³ò¨S¦³¿ù»~È
- If Not Range("C2", Range("D2").End(xlDown)).SpecialCells(xlCellTypeFormulas, xlErrors) Is Nothing Then
- Exit Sub '¦¹Àɮתì¶}©l³sµ²®É§Y±Ò°Ê«ºâ ->¦ý¬O©|¦³¥¼³sµ²¨ìªºÀx¦s®æ·|¶Ç¦^¿ù»~È
- End If
- t:
- A = Application.Transpose(Range("C2", Range("D2").End(xlDown)).Value) '§Y®É¦¨¥æ»ù»P¦¨³æ¶q½d³ò°}¦C
- If TheTime <> TimeSerial(Hour(Time), Minute(Time), 0) Then '³]©w¨C¤ÀÄÁ¾ã
- ReDim AR(2 To Range("b2").End(xlDown).Row, 1 To 6)
- Ex
- TheTime = TimeSerial(Hour(Time), Minute(Time), 0)
- Else
- Ex
- End If
- If IsEmpty(B) Then '¤ñ¹ï°}¦C¬°¸ê®Æ
- For Each E In Range("b2", Range("b2").End(xlDown))
- With Sheets(E.Text).Cells(Rows.Count, "j").End(xlUp)
- .Offset(1) = E(1, 2) '°O¿ý¤U ¦¨¥æ»ù
- .Offset(1, 1) = E(1, 3) '°O¿ý¤U ³æ¶q
- .Offset(1, 2).Resize(1, 6) = Application.Index(AR, E.Row - 1) 'Ū¨ú¤@¤ÀÄÁ¤ºªº¸ê®Æ
- End With
- Next
- Else
- For i = 1 To UBound(A, 2)
- If A(1, i) <> B(1, i) Or A(2, i) <> B(2, i) Then ' ¼i¬ù»ùªº(¦¨¥æ»ù©Î¦¨³æ¶q)¦³ÅÜ°Ê
- With Sheets([B2].Cells(i, 1).Text).Cells(Rows.Count, "j").End(xlUp)
- .Offset(1) = [B2].Cells(i, 2) '°O¿ý¤U §Y®É¦¨¥æ»ù
- .Offset(1, 1) = [B2].Cells(i, 3) '°O¿ý¤U ³æ¶q
- .Offset(1, 2).Resize(1, 6) = Application.Index(AR, i) 'Ū¨ú¤@¤ÀÄÁ¤ºªº¸ê®Æ
- End With
- End If
- Next
- End If
- B = A
- End Sub
½Æ»s¥N½X- Sub Ex() 'Sheet1ªºµ{¦¡½X §Aµo°Ýªº¨º½g [dde tick¸ê®ÆÂà´«¤ÀÄÁ¸ê®Æ]
- '½Ð°Ý¦¬½L»ù¬O¦ó®Éªº»ù®æ
- Dim i%
- For i = 2 To [B1].End(xlDown).Row
- If TheTime <> TimeSerial(Hour(Time), Minute(Time), 0) Then
- AR(i, 1) = TimeSerial(Hour(Time), Minute(Time), 0) '¨C¤ÀÄÁ®É¶¡
- If IsEmpty(B) Then
- If IsEmpty(¶}½L»ù) Then ReDim ¶}½L»ù(2 To UBound(AR))
- ¶}½L»ù(i) = Cells(i, "C") '¶}½L»ù
- End If
- AR(i, 2) = ¶}½L»ù(i)
- AR(i, 3) = Cells(i, "C") '¨C¤ÀÄÁªº³Ì°ª»ù
- AR(i, 4) = Cells(i, "C") '¨C¤ÀÄÁªº³Ì§C»ù
- ' AR(i, 5) = Cells(i, "C") '½Ð°Ý¦¬½L»ù¬O¦ó®Éªº»ù®æ
- AR(i, 6) = Cells(i, "D") '¨C¤ÀÄÁªº¦¨¥æ¶q
- Else
- AR(i, 3) = IIf(Cells(i, "C") > AR(i, 3), Cells(i, "C"), AR(i, 3)) '¨C¤ÀÄÁªº³Ì°ª»ù
- AR(i, 4) = IIf(Cells(i, "C") < AR(i, 4), Cells(i, "C"), AR(i, 4)) '¨C¤ÀÄÁªº³Ì§C»ù
- ' AR(i, 5) = Cells(i, "C") '¨C¤ÀÄÁªº¦¬½L»ù
- AR(i, 6) = AR(i, 6) + Cells(i, "D") '¨C¤ÀÄÁªº¦¨¥æ¶q
- End If
- Next
- End Sub
½Æ»s¥N½X |
|