|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
傳統的迴遊法///
Sub TEST_A3()
Dim Arr, T$, T1$, T2$, TT$, i&, j%, x&, N&
Arr = Range([c2], [a65536].End(3))
For i = 2 To UBound(Arr)
T1 = Arr(i, 1): T2 = Arr(i, 3): T = T1 & T2
If T1 = "" Or T2 = "" Then GoTo i01
If T <> TT Then
N = N + 1: TT = T
For j = 1 To 3: Arr(N + 1, j) = Arr(i, j): Next
For x = i + 1 To UBound(Arr)
If Arr(x, 1) & Arr(x, 3) = TT Then
Arr(x, 1) = ""
Arr(N + 1, 2) = Arr(N + 1, 2) + Arr(x, 2)
End If
Next x
End If
i01: Next i
[e2].Resize(N + 1, 3) = Arr
End Sub
|
|