|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub testg()
Set d = CreateObject("scripting.dictionary")
arr = ActiveSheet.UsedRange
For j = 2 To UBound(arr)
For i = 3 To 6
If Not d.exists(arr(j, 1) & arr(1, i)) Then
Set d(arr(j, 1) & arr(1, i)) = CreateObject("scripting.dictionary")
End If
d(arr(j, 1) & arr(1, i))(arr(j, i)) = d(arr(j, 1) & arr(1, i))(arr(j, i)) + 1
Next i
Next j
For j = 2 To UBound(arr)
If Len(arr(j, 7)) > 0 Then
For i = 8 To 10
str1 = ""
For Each k In d(arr(j, 7) & arr(1, i)).keys
str1 = str1 & "-" & k & d(arr(j, 7) & arr(1, i))(k)
Next k
arr(j, i) = Mid(str1, 2)
Next i
End If
Next j
ActiveSheet.UsedRange = arr
End Sub
|
|