|
数组法,请楼主参考 。。。
Sub TEST()
Dim arr, brr, i&, j&, iMin&, iMax&, t#
Application.ScreenUpdating = False
brr = Split([BH1], "~"): t = Timer
iMin = Val(brr(0)): iMax = Val(brr(1))
With Range("C2").CurrentRegion
arr = Intersect(.Offset(), .Offset(1))
End With
With Range("BH1").CurrentRegion
.Offset(2, 2).ClearContents
brr = Intersect(.Offset(), .Offset(2))
End With
For i = 1 To UBound(brr)
If brr(i, 1) >= iMin And brr(i, 1) <= iMax Then
For j = 1 To UBound(arr, 2)
brr(i, j + 2) = arr(i, j)
Next j
End If
Next i
[BH3].Resize(UBound(brr), UBound(brr, 2)) = brr
Application.ScreenUpdating = True
MsgBox "执行完毕!_用时: " & Format(Timer - t, "0.00") & " 秒", 64
End Sub
|
|