|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub test() '前面的是按你的要求做的,那就再做一下请测试
Dim s As New Collection, d As Object, ar(), br
Dim rmb&, lr&, r&, c%, n&, i%, j%, k%
Set d = CreateObject("scripting.dictionary")
lr = Cells(Rows.Count, 1).End(xlUp).Row
br = Range("b2:f" & lr)
ReDim ar(1 To UBound(br), 1 To 1)
For r = 1 To UBound(br)
d.RemoveAll
For c = 1 To 5
s.Add br(r, c)
d(br(r, c)) = ""
Next
123
k = s.Count
For i = 1 To k - 1
For j = i + 1 To k
If s(j) = s(i) Then
s.Remove (j)
s.Remove (i)
GoTo 123
End If
Next
Next
rmb = n + IIf(s.Count = 1 And d.Count > 2, 6493, -720) '3+2、4+1、5同的都不算
ar(r, 1) = rmb
n = rmb
For i = 1 To s.Count
s.Remove (1)
Next
Next
[g2].Resize(UBound(ar)) = ar
Set d = Nothing
End Sub |
评分
-
1
查看全部评分
-
|