|
楼主 |
发表于 2019-1-21 11:16
|
显示全部楼层
我在网上查了一下代码,这个可以用,Sub 查找()
Dim jieguo As String, p As String, q As String
Dim c As Range
jieguo = Application.InputBox(prompt:="请输入要查找的值:", Title:="查找", Type:=2)
If jieguo = "False" Or jieguo = "" Then Exit Sub
Application.ScreenUpdating = False
Application.DisplayAlerts = False
With ActiveSheet.Cells
Set c = .Find(jieguo, , , xlWhole, xlByColumns, xlNext, False)
If Not c Is Nothing Then
p = c.Address
Do
c.Interior.ColorIndex = 4
q = q & c.Address & vbCrLf
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> p
End If
End With
MsgBox "查找数据在以下单元格中:" & vbCrLf & vbCrLf _
& q, vbInformation + vbOKOnly, "查找结果"
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
但是 q, vbInformation + vbOKOnly, "查找结果"这话出错,怎么理解?我想做成一共查到几处,也就是说一共查到几场监考 |
|