- ©«¤l
- 4901
- ¥DÃD
- 44
- ºëµØ
- 24
- ¿n¤À
- 4916
- ÂI¦W
- 255
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Office 20xx
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_
- µù¥U®É¶¡
- 2010-4-30
- ³Ì«áµn¿ý
- 2024-11-25
|
¦^´_ 1# mmggmm - Private Sub Worksheet_Change(ByVal Target As Range) '¤ëµ²
- If Intersect(Target, Union([A1], [C1])) Is Nothing Then Exit Sub
- Set d = CreateObject("Scripting.Dictionary")
- MyDay = [A1] & [C1]
- With Sheets("Main")
- For Each a In .Range(.[A2], .[A2].End(xlDown))
- If Format(a, "yyyym") = MyDay Then
- If IsEmpty(d(a.Offset(, 1).Value)) Then
- d(a.Offset(, 1).Value) = Array(a.Offset(, 1).Value, a.Offset(, 2).Value, a.Offset(, 3).Value, a.Offset(, 4).Value)
- Else
- ar = d(a.Offset(, 1).Value)
- ar(2) = ar(2) + a.Offset(, 3): ar(3) = ar(3) + a.Offset(, 4)
- d(a.Offset(, 1).Value) = ar
- Erase ar
- End If
- End If
- Next
- Me.Range("A1").CurrentRegion.Offset(3).ClearContents
- If d.Count > 0 Then Me.[A3].Resize(d.Count, 4) = Application.Transpose(Application.Transpose(d.items))
- End With
- End Sub
½Æ»s¥N½X- Private Sub Worksheet_Change(ByVal Target As Range) '¦~µ²
- If Intersect(Target, [A1]) Is Nothing Then Exit Sub
- Set d = CreateObject("Scripting.Dictionary")
- MyYear = [A1]
- With Sheets("Main")
- For Each a In .Range(.[A2], .[A2].End(xlDown))
- If Year(a) = MyYear Then
- If IsEmpty(d(a.Offset(, 1).Value)) Then
- d(a.Offset(, 1).Value) = Array(a.Offset(, 1).Value, a.Offset(, 2).Value, a.Offset(, 3).Value, a.Offset(, 4).Value)
- Else
- ar = d(a.Offset(, 1).Value)
- ar(2) = ar(2) + a.Offset(, 3): ar(3) = ar(3) + a.Offset(, 4)
- d(a.Offset(, 1).Value) = ar
- Erase ar
- End If
- End If
- Next
- Me.Range("A1").CurrentRegion.Offset(3).ClearContents
- If d.Count > 0 Then Me.[A3].Resize(d.Count, 4) = Application.Transpose(Application.Transpose(d.items))
- End With
- End Sub
½Æ»s¥N½X |
|