Is it possible to have three options on the message box?
A option to go back to the top of the sheet (A1)
after you say Yes or No or the search name is not found.
Thank you for your help.
If MsgBox("Continue?", vbYesNo) <> vbNo Then
GoTo Flag1
Sub Search()
Dim vResult1, vResult2
Dim rFound As Range
Dim Lookfor As String
Lookfor = InputBox("Enter Name", "Search")
If Lookfor = "" Then
End
End If
On Error Resume Next
With Sheet1.Range("a:a") 'Sheet1 is the CodeName
Set rFound = .Find _
(What:=Lookfor, After:=.Cells(1, 1), LookIn:=xlValues, LookAt:=xlWhole)
End With
Flag1:
If Not Cells.Find(What:=Lookfor, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False) Is Nothing Then
Cells.Find(What:=Lookfor, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
If MsgBox("Continue?", vbYesNo) <> vbNo Then
GoTo Flag1
End If
Else
MsgBox ("The Name Was Not Found")
End If
End Sub
A option to go back to the top of the sheet (A1)
after you say Yes or No or the search name is not found.
Thank you for your help.
If MsgBox("Continue?", vbYesNo) <> vbNo Then
GoTo Flag1
Sub Search()
Dim vResult1, vResult2
Dim rFound As Range
Dim Lookfor As String
Lookfor = InputBox("Enter Name", "Search")
If Lookfor = "" Then
End
End If
On Error Resume Next
With Sheet1.Range("a:a") 'Sheet1 is the CodeName
Set rFound = .Find _
(What:=Lookfor, After:=.Cells(1, 1), LookIn:=xlValues, LookAt:=xlWhole)
End With
Flag1:
If Not Cells.Find(What:=Lookfor, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False) Is Nothing Then
Cells.Find(What:=Lookfor, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
If MsgBox("Continue?", vbYesNo) <> vbNo Then
GoTo Flag1
End If
Else
MsgBox ("The Name Was Not Found")
End If
End Sub