- ©«¤l
- 1446
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1470
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-11-28
|
ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«½m²ß°}¦C»P¦r¨å,¤µ¤Ñ¤~¸Õ¥XUnion()ªºµ²ªG¤]¬O°}¦C,¾Ç²ß¤è®×¦p¤U,
½Ð¦U¦ì«e½ú«ü±Ð
°õ¦æ«e:
°õ¦æµ²ªG:
Option Explicit
Sub TEST()
Dim Brr, V, Y, N&, i&, T1$, T3$, T4$, T6$, TT1$, xR As Range
Set Y = CreateObject("Scripting.Dictionary")
Set xR = Range([G1], Cells(Rows.Count, "A").End(xlUp)): Brr = xR
For i = 2 To UBound(Brr)
T1 = Brr(i, 1): T3 = Brr(i, 3): T4 = Brr(i, 4): T6 = Brr(i, 6)
TT1 = T1 & "|" & T3 & "|" & Split(T4 & "-", "-")(1)
If Y.Exists(TT1) = Empty Then
Set Y(TT1) = Cells(i, 7): Y(TT1 & "³æ»ù") = Brr(i, 6)
ElseIf Brr(i, 6) <> Y(TT1 & "³æ»ù") Then
Set Y(TT1) = Union(Y(TT1), Cells(i, 7)): Y(TT1 & "³æ»ù") = "|"
End If
Next
xR.Offset(1, 6).ClearContents
For Each V In Y.items
If IsArray(V) Then N = N + 1: V.Value = "A" & N
Next
Set Y = Nothing: Set xR = Nothing: Erase Brr
End Sub |
|