Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mx Mx is offline
external usenet poster
 
Posts: 2
Default How to write code for find a word in excel?

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How to write code for find a word in excel?

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

--
Gary''s Student - gsnu2007


"Mx" wrote:

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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
Mx Mx is offline
external usenet poster
 
Posts: 2
Default How to write code for find a word in excel?

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_

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read/write excel and word 2007 documents from another application mco3006 Excel Discussion (Misc queries) 0 April 27th 10 10:18 AM
how i can write arabic numbers by microsoft excel word medo Excel Discussion (Misc queries) 1 February 10th 09 12:48 AM
How to write late-binding code in XL VBA for Word objects? Ed from AZ Excel Programming 4 August 29th 07 03:04 PM
Write to Word Document from Excel VBA Help Needed JudyHNM Excel Programming 2 April 26th 07 02:28 AM
Find part of a word in Advanced Filter Code Sierras Excel Programming 5 March 10th 06 07:44 PM


All times are GMT +1. The time now is 11:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"