Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50110

Display Multiple Results in 1 Message Box Output

$
0
0
Have the below code which displays results of what the user enters in a textbox - only issue is it gives multiple output boxes. Any way all results can be displayed on 1 message box?

Code:

Private Sub CommandButton6_Click()

Sheet3.Activate
Dim Answer, Reply
Dim b As Range

Answer = Application.InputBox("Enter the text to search for.", "Search Tool")

With Cells
Set c = .Find(Answer, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Reply = MsgBox("Book Code = " & c.Offset(0, -1).Value & vbNewLine & _
"Book Name =  " & c.Value)

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


Viewing all articles
Browse latest Browse all 50110

Trending Articles