- ©«¤l
- 976
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 1018
- ÂI¦W
- 0
- §@·~¨t²Î
- Win10
- ³nÅ骩¥»
- Office 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-4-19
- ³Ì«áµn¿ý
- 2024-12-18
|
¥»©«³Ì«á¥Ñ samwang ©ó 2021-8-27 16:18 ½s¿è
¦^´_ 13# sillykin
¬Û¦P: V~Yªºµ²ªG¬O¥Ñ"¤H¤u¦W¥U"©M"·|p¦W¥U"²£¥X¨Ì¾Ú±ø¥ó¤@¼Ë(¤á¦W+¬d¸ß¤é)
¤£¬Û¦P: ±ø¥ó¦p¤W¡Aµ²ªGAA~ADÄæ
¦ý¤]»ÝnA-DÄæ¦ìªº½Æ»s¤Î±Æ§Ç >> ³oµLªk¼g¡A¦]¬°¨S¦³³W«h
Sub test()
Dim Arr, Brr(), Crr(), xD, xD1, T$, i&, n%, n1%
Set xD = CreateObject("Scripting.Dictionary")
Set xD1 = CreateObject("Scripting.Dictionary")
Arr = Range([¤H¤u¦W¥U!a1], [¤H¤u¦W¥U!c65536].End(3))
ReDim Brr(1 To UBound(Arr), 1 To 4) '¬Û¦P
ReDim Crr(1 To UBound(Arr), 1 To 4) '¤£¬Û¦P
For i = 2 To UBound(Arr)
T = Arr(i, 3) & "_" & Arr(i, 1)
xD(T) = Array(Arr(i, 1), Arr(i, 3))
Next
Arr = Range([·|p¦W¥U!a1], [·|p¦W¥U!c65536].End(3))
For i = 2 To UBound(Arr)
T = Arr(i, 2) & "_" & Arr(i, 3)
xD1(T) = Array(Arr(i, 1), Arr(i, 2), Arr(i, 3))
Next
For Each ky In xD
If xD1.Exists(ky) Then
n = n + 1: Brr(n, 1) = xD(ky)(0): Brr(n, 3) = xD(ky)(1)
n = n + 1: For j = 2 To 4: Brr(n, j) = xD1(ky)(j - 2): Next
Else
n1 = n1 + 1: Crr(n1, 1) = xD(ky)(0): Crr(n1, 3) = xD(ky)(1)
End If
Next
For Each ky In xD1
If Not xD.Exists(ky) Then
n1 = n1 + 1: For j = 2 To 4: Crr(n1, j) = xD1(ky)(j - 2): Next
End If
Next
With Sheets("¤ñ¹ï")
If n > 0 Then '¬Û¦P
.[v1:y1] = Array("¤é´Á", "²Î¤@½s¸¹", "¤á¦W", "¬d¸ß¤é")
.[v2].Resize(n, 4) = Brr
End If
If n1 > 0 Then '¤£¬Û¦P
.[aa1:ad1] = Array("¤é´Á", "²Î¤@½s¸¹", "¤á¦W", "¬d¸ß¤é")
.[aa2].Resize(n1, 4) = Crr
End If
End With
End Sub |
|