Since more than one row may contain part of the text, then the mmesage box will ask if what wqs found is correct or not. If not, then find next.
If answwer s yes, then display message box with data contain in more than one cell within the row.
I have been searching the forums and this is what I was able to put together.This is two different codes I found and tried to make them work as one.
Expand|Select|Wrap|Line Numbers
- Sub SearchAccount()
- Dim vResult1, vResult2
- Dim rFound As Range
- Dim Lookfor As String
- Lookfor = InputBox("Enter Account Title", "Search")
- If Lookfor = "" Then
- End
- End If
- On Error Resume Next
- With Sheet1.Range("H:H") '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("Is this the correct Account?", vbYesNo) <> vbYes Then
- GoTo Flag1
- End If
- If rFound Is Nothing Then
- MsgBox "For Account Number : " _
- & rFound(1, 2) & " , the Banker name is : " & rFound(1, 3)
- End If
- Else
- MsgBox ("The Account Title is not in the list")
- End If
- End Sub
This does not seems to work for answer "YES", instead it display only the "For Account Number : " but not the line below
I got some of your code from
http://bytes.com/topic/visual-basic/...next-input-box