|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
加个判断后跳出,仅供参考
Sub CommandButton查找_Click1()
Set d = CreateObject("scripting.dictionary")
Application.ScreenUpdating = False
Sheet2.Activate
[a5:an4000].Clear
tj = [b3]
arr = Sheet1.UsedRange
For i = 1 To UBound(arr)
For j = 1 To UBound(arr, 2)
If arr(i, j) Like "*" & tj & "*" Then
If Not d.exists(i) Then
d(i) = ""
r = r + 1
For x = 1 To UBound(arr, 2)
arr(r, x) = arr(i, x)
Next x
If r >= 10 Then GoTo 100
End If
End If
Next
Next
100:00:00
If d.Count > 0 Then
Sheet2.Cells(6, 1).Resize(r, UBound(arr, 2)) = arr
End If
Application.ScreenUpdating = True
Columns("a:a").NumberFormatLocal = "yyyy年m月d日"
End Sub
|
|