|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与一下。。。- Sub ykcbf() '//2024.1.11
- Dim arr, brr, d, s
- Set d = CreateObject("Scripting.Dictionary")
- arr = Sheets("数据源").UsedRange
- On Error Resume Next
- For i = 2 To UBound(arr)
- For j = 7 To UBound(arr, 2)
- s = arr(i, 1) & "|" & arr(1, j)
- d(s) = d(s) + IIf(j > 52, -arr(i, j), arr(i, j))
- Next
- Next
- With Sheets("计算")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .Range("a1:o" & r)
- For i = 2 To UBound(arr)
- For j = 2 To UBound(arr, 2)
- s = arr(i, 1) & "|" & arr(1, j)
- arr(i, j) = d(s)
- Next
- Next
- .Range("a1:o" & r) = arr
- .Range("a1:o" & r).Borders.LineStyle = 1
- ActiveWindow.DisplayZeros = False
- End With
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
2
查看全部评分
-
|