0
我希望我的宏能夠搜索相關文本的特定行,以便它只搜索該行而不搜索其他行。例如,當你輸入「dave」時,它應該只在E行搜索「dave」。如何搜索一行
Dim Answer, Reply
Dim b As Range
Answer = Application.InputBox("Enter the text to search for.", "Search Tool")
With Rows
Set c = .Find(Answer, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Reply = MsgBox("Has this piece been edited? " & c.Address & _
" which has a value of " & c.Value & "?", vbQuestion + _
vbYesNoCancel, "Cell Hi-Liter")
If Reply = vbYes Then
c.Select
Selection.Copy
Selection.Offset(0, 1).Select
ActiveSheet.Paste
Exit Do
End If
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
Else
MsgBox "Your search text was not found.", vbOKOnly, "Text Not Found"
End If
End With
End Sub
我該如何做到這一點?
以及您的問題在哪裏? –
我似乎無法創建在特定行中進行搜索的功能。它只是剔除錯誤。 – user2645253
'E'行不存在 - 你的意思是你想在'Dave'的每一行中搜索E列嗎? – MattCrum