|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub AwTest()
Dim i%, iStr$, arr, d As Object
Set d = CreateObject("Scripting.Dictionary")
arr = [a1].CurrentRegion
For i = 1 To UBound(arr)
If Len(arr(i, 1)) = 3 Then
d(arr(i, 1)) = d(arr(i, 1)) + arr(i, 2)
Else
d(Left(arr(i, 1), 3)) = d(Left(arr(i, 1), 3)) + arr(i, 2)
d(Left(arr(i, 1), 1)) = d(Left(arr(i, 1), 1)) + arr(i, 2)
End If
Next
For i = 1 To UBound(arr)
If Len(arr(i, 2)) = 0 Then iStr = arr(i, 1): arr(i, 2) = d(iStr)
Next
[a1].CurrentRegion = arr
End Sub
凑一个!! |
|