|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
估计你不是点按钮的,引用位置不对,造成问题。。。
Option Explicit
Sub TEST()
Dim Rng As Range, rngFind As Range, ar, i&
Set Rng = Sheets("月计划").[A1].CurrentRegion
With Sheets("周计划").[A1].CurrentRegion
.Offset(4, 1).ClearContents
ar = .Value
For i = 2 To UBound(ar, 2) Step 2
Set rngFind = Rng.Find(ar(2, i), , , xlWhole)
If Not rngFind Is Nothing Then
With Range(rngFind.Offset(1), rngFind.Offset(10)).Resize(, 2)
.Copy Sheets("周计划").Cells(5, i)
End With
End If
Next i
End With
Set Rng = Nothing: Set rngFind = Nothing
Beep
End Sub |
|