|
楼主 |
发表于 2017-2-26 00:09
|
显示全部楼层
请求帮忙!!
http://club.excelhome.net/thread-1330535-1-1.html
(出处: ExcelHome技术论坛)
Private Sub CommandButton1_Click()
Dim arr, brr(1 To 10000, 1 To 5), w$
Dim x%, i%, n%, j%
Dim c As Range
If ComboBox1.Value = "" Then
MsgBox "输入错误或空值"
Exit Sub
End If
w = ComboBox1.Value
With Sheet1
Set c = .Range("b:b").Find(w, , , xlWhole, , xlPrevious)
If c Is Nothing Then
MsgBox "查询人员不存在!"
ComboBox1.Value = ""
Exit Sub
End If
arr = .Range("a2:i" & .Range("a65536").End(xlUp).Row)
End With
For i = 1 To UBound(arr)
If arr(i, 2) = w Then
n = n + 1
brr(n, 1) = arr(i, 1): brr(n, 2) = arr(i, 2): brr(n, 3) = arr(i, 3)
brr(n, 4) = arr(i, 6): brr(n, 5) = arr(i, 9)
End If
Next
With Sheet3
.Range("a2:e1000") = ""
.Range("a2").Resize(n, 5) = brr
End With
Sheet3.Activate
UserForm2.Hide
End Sub |
评分
-
1
查看全部评分
-
|