Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

How to write code for find a word in excel?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mx - 15 Sep 2007 02:23 GMT
For example , there is two textbox and one command button.
If i press the command button the text entered in the first textbox
will find in xlworkbook and shown in second textbox with a msgbox ?
All sugestions are welcomed.
Gary''s Student - 15 Sep 2007 12:44 GMT
Attach the following macro to a Forms button:

Sub mx_sub()
Dim s As String, t As String
t = Chr(10) & Chr(10)
s = Application.InputBox("Enter the Word: ")
For Each r In ActiveSheet.UsedRange
With r
   If InStr(1, .Value, s) > 0 Then
       MsgBox ("Found the Word in cell " & .Address & t & .Value)
       Exit Sub
   End If
End With
Next
MsgBox ("Did not find the Word")
End Sub

Signature

Gary''s Student - gsnu2007

> For example , there is two textbox and one command button.
> If i press the command button the text entered in the first textbox
> will find in xlworkbook and shown in second textbox with a msgbox ?
> All sugestions are welcomed.
Mx - 18 Sep 2007 04:45 GMT
Dear,

Thanks to Reply my question? Could explain how the code works?

Ya sure I try your coding and i get my result.

Once again thank you.

                               _ Jawahar S_
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.