|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("类型1")
- r1 = .Cells(.Rows.Count, 4).End(xlUp).Row
- c1 = .Cells(2, .Columns.Count).End(xlToLeft).Column
- brr = .Range("k1:k" & r1)
- For i = 2 To UBound(brr) Step 2
- d(brr(i, 1)) = i
- Next
- End With
- With Worksheets("计算表格")
- r2 = .Cells(.Rows.Count, 4).End(xlUp).Row
- c2 = .Cells(2, .Columns.Count).End(xlToLeft).Column
- arr = .Range("k1:k" & r2)
- For i = 3 To UBound(arr) Step 2
- If d.exists(arr(i, 1)) Then
- m = d(arr(i, 1))
- Worksheets("类型1").Cells(m, 12).Resize(2, c1 - 11).Copy
- .Cells(i, 12).PasteSpecial Paste:=xlPasteFormulas, operation:=xlNone, skipblanks:=False, Transpose:=False
- End If
- Next
- End With
-
- End Sub
复制代码 |
|