|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
代码如下:
- Sub ykcbf() '//2024.3.8
- Dim arr, d
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("工资")
- r = .Cells(.Rows.Count, "a").End(xlUp).Row
- arr = .[a1].Resize(r, 4)
- End With
- For i = 2 To UBound(arr)
- s = CStr(arr(i, 2))
- If InStr(arr(i, 1), "广州") = 0 Then
- d(s) = d(s) + arr(i, 4)
- End If
- Next
- With Sheets("汇总")
- r = .Cells(.Rows.Count, "c").End(xlUp).Row
- arr = .[a1].Resize(r, 5)
- For i = 4 To UBound(arr)
- s = CStr(arr(i, 3))
- If InStr(arr(i, 2), "广州") = 0 Then
- If d.Exists(s) Then
- arr(i, 5) = d(s)
- End If
- End If
- Next
- .[a1].Resize(r, 5) = arr
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
2
查看全部评分
-
|