|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
参与一下。。。- Sub ykcbf() '//2024.1.18
- 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, 5)
- End With
- For i = 2 To UBound(arr)
- s = arr(i, 1) & "|" & arr(i, 2) & "~" & arr(i, 3)
- d(s) = arr(i, 4)
- Next
- With Sheets("奖励情况统计")
- r = .Cells(.Rows.Count, "a").End(xlUp).Row
- arr = .Range("a1:av" & r)
- For i = 2 To UBound(arr)
- For j = 3 To UBound(arr, 2) Step 3
- s = arr(i, 1) & "|" & Replace(Trim(arr(1, j)), "名人数", "")
- If d.Exists(s) Then
- If arr(i, j) <> Empty Then
- arr(i, j + 1) = d(s)
- arr(i, j + 2) = arr(i, j) * arr(i, j + 1)
- Else
- arr(i, j + 1) = 0
- arr(i, j + 2) = 0
- End If
- End If
- Next
- Next
- .Range("a1:av" & r) = arr
- ActiveWindow.DisplayZeros = False
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|