我有一个电子表格用于一年中的每个月,我的宏搜索每个月的特定值,显示弹出窗口是否已找到。
我想要做的只是显示与我的查询匹配的结果(我显示每次迭代(月)的结果,即使它没有找到)。
Sub Search()
res = InputBox("Who are you looking for?")
For w = 2 To Worksheets.Count
With Worksheets(w)
Set Rng = .Cells '<< The Entire Sheet is Searched
With Rng
Set MyChoice = .Find(What:=res)
If Not MyChoice Is Nothing Then
Application.Goto MyChoice
MsgBox "Found " & res & " in " & Worksheets(w).Name
Else
MsgBox "Not Found! " & res & " in " & Worksheets(w).Name
End If
End With
End With
Next w
Worksheets(1).Activate
End Sub
非常感谢!