|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
参与一下。。。
- Sub ykcbf() '//2024.4.28
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("Sheet1")
- r = .Cells(Rows.Count, 1).End(3).Row
- c = .UsedRange.Columns.Count
- arr = .[a1].Resize(r, c)
- End With
- For i = 1 To UBound(arr) Step 9
- For j = 2 To UBound(arr, 2)
- s = arr(i + 1, 1) & "|" & arr(i + 2, j)
- If arr(i + 2, j) <> Empty Then
- d(s) = arr(i + 6, j)
- End If
- Next
- Next
- With Sheets("Sheet2")
- r = .Cells(Rows.Count, 1).End(3).Row
- c = .UsedRange.Columns.Count
- arr = .[a1].Resize(r, c)
- For i = 2 To UBound(arr)
- For j = 3 To UBound(arr, 2) - 1
- s = arr(i, 1) & "|" & arr(1, j)
- If d.exists(s) Then
- arr(i, j) = d(s)
- End If
- Next
- arr(i, c) = Val(arr(i, c - 3)) + Val(arr(i, c - 2)) + Val(arr(i, c - 1))
- Next
- .[a1].Resize(r, c) = arr
- .[a1].Resize(r, c).Borders.LineStyle = 1
- End With
- Set d = Nothing
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|