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

¥[¯Z¶O­pºâ

¦^´_ 1# mmggmm
  1. Private Sub Worksheet_Change(ByVal Target As Range) '¤ëµ²
  2. If Intersect(Target, Union([A1], [C1])) Is Nothing Then Exit Sub
  3. Set d = CreateObject("Scripting.Dictionary")
  4. MyDay = [A1] & [C1]
  5. With Sheets("Main")
  6. For Each a In .Range(.[A2], .[A2].End(xlDown))
  7.    If Format(a, "yyyym") = MyDay Then
  8.      If IsEmpty(d(a.Offset(, 1).Value)) Then
  9.         d(a.Offset(, 1).Value) = Array(a.Offset(, 1).Value, a.Offset(, 2).Value, a.Offset(, 3).Value, a.Offset(, 4).Value)
  10.         Else
  11.         ar = d(a.Offset(, 1).Value)
  12.         ar(2) = ar(2) + a.Offset(, 3): ar(3) = ar(3) + a.Offset(, 4)
  13.         d(a.Offset(, 1).Value) = ar
  14.         Erase ar
  15.      End If
  16.     End If
  17. Next
  18. Me.Range("A1").CurrentRegion.Offset(3).ClearContents
  19. If d.Count > 0 Then Me.[A3].Resize(d.Count, 4) = Application.Transpose(Application.Transpose(d.items))
  20. End With
  21. End Sub
½Æ»s¥N½X
  1. Private Sub Worksheet_Change(ByVal Target As Range) '¦~µ²
  2. If Intersect(Target, [A1]) Is Nothing Then Exit Sub
  3. Set d = CreateObject("Scripting.Dictionary")
  4. MyYear = [A1]
  5. With Sheets("Main")
  6. For Each a In .Range(.[A2], .[A2].End(xlDown))
  7.    If Year(a) = MyYear Then
  8.      If IsEmpty(d(a.Offset(, 1).Value)) Then
  9.         d(a.Offset(, 1).Value) = Array(a.Offset(, 1).Value, a.Offset(, 2).Value, a.Offset(, 3).Value, a.Offset(, 4).Value)
  10.         Else
  11.         ar = d(a.Offset(, 1).Value)
  12.         ar(2) = ar(2) + a.Offset(, 3): ar(3) = ar(3) + a.Offset(, 4)
  13.         d(a.Offset(, 1).Value) = ar
  14.         Erase ar
  15.      End If
  16.     End If
  17. Next
  18. Me.Range("A1").CurrentRegion.Offset(3).ClearContents
  19. If d.Count > 0 Then Me.[A3].Resize(d.Count, 4) = Application.Transpose(Application.Transpose(d.items))
  20. End With
  21. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 5# mmggmm
³o¦æOffset(3)¿ù»~
§ï¦¨
Me.Range("A1").CurrentRegion.Offset(2).ClearContents
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ¡i®É¤é²öªÅ¹L¡j¤@­Ó¤H¦b¥@¶¡°µ¤F¦h¤Ö¨Æ¡A´Nµ¥©ó¹Ø©R¦³¦hªø¡C¦]¦¹¥²¶·»P®É¶¡Ävª§¡A¤Á²ö¨Ï®É¤éªÅ¹L¡C
ªð¦^¦Cªí ¤W¤@¥DÃD