- ©«¤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-10-30
|
¥»©«³Ì«á¥Ñ samwang ©ó 2021-8-26 16:32 ½s¿è
¦^´_ 4# sillykin
½Ð´ú¸Õ¬Ý¬Ý¡AÁÂÁÂ
¥t¥~¡A±z´£¨Ñ¸ê®Æ¤£¬Û²Å¦Xªºµ²ªG©M§Úªºµ²ªG¤£¤@¼Ë¡A½Ð¦A½T»{¡AÁÂÁÂ
Sub test()
Dim Arr, xD, Brr(), Crr(), T$, T1$, n%, n1%, i&, j%
Arr = Range([¤ñ¹ï!a1], [¤ñ¹ï!d65536].End(3))
Set xD = CreateObject("Scripting.Dictionary")
ReDim Brr(1 To UBound(Arr), 1 To 4)
ReDim Crr(1 To UBound(Arr), 1 To 4)
n = 1
For i = 2 To UBound(Arr)
If i = UBound(Arr) Then GoTo 99
If Arr(i, 1) <> "" And Arr(i + 1, 1) = "" Then
T = Arr(i, 1) & "_" & Arr(i, 3)
For i2 = i + 1 To UBound(Arr)
If Arr(i2, 4) <> "" Then
T1 = Arr(i2, 4) & "_" & Arr(i, 3)
If T = T1 Then
Brr(n, 1) = Arr(i, 1)
Brr(n, 3) = Arr(i, 3)
Brr(n + 1, 2) = Arr(i2, 2)
Brr(n + 1, 3) = Arr(i2, 3)
Brr(n + 1, 4) = Arr(i2, 4)
n = n + 2: xD(T1) = 1: Exit For
End If
Else
Exit For
End If
Next i2
End If
99: Next i
For i = 2 To UBound(Arr)
If Arr(i, 1) <> "" Then
T = Arr(i, 1) & "_" & Arr(i, 3)
Else
T = Arr(i, 4) & "_" & Arr(i, 3)
End If
If xD(T) <> 1 Then
n1 = n1 + 1
For j = 1 To 4: Crr(n1, j) = Arr(i, j): Next
End If
Next
Sheets("¤ñ¹ï").[h2].Resize(n, 4) = Brr
Sheets("¤ñ¹ï").[o2].Resize(n1, 4) = Crr
End Sub |
|