按我的理解做的,请看
Nflxd0Lk.rar
(12.76 KB, 下载次数: 92)
,代码
Private Sub CommandButton1_Click()
Dim c As Range
Dim t$, k%
Dim s
s = Range("f1")
k = 3
Application.ScreenUpdating = False
Range("a:d").Clear
If s = "" Then Exit Sub '如果f1空白的话,退出程序
With Sheet2
Set c = .Columns(1).Find(s, lookat:=xlPart) '按部分搜索
If Not c Is Nothing Then '如果搜索到了
t = c.Address '记录第一个的地址
Do
c.CurrentRegion.Copy Cells(k, 1) '复制里面的数据过来
k = k + c.CurrentRegion.Rows.Count + 1
Set c = .Columns(1).FindNext(c)
Loop Until c Is Nothing Or c.Address = t '一直到找到全部的
End If
End With
Application.ScreenUpdating = True
End Sub
|