Find Text with command button

Abdulkhadar

Board Regular
Joined
Nov 10, 2013
Messages
165
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Hi All,
How to find a word or number in protected sheet through command button?

thanks
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Record a macro when doing Control F ( for Find ), then put the macro in the code for the button.
 
Upvote 0
Record a macro when doing Control F ( for Find ), then put the macro in the code for the button.

Thanks for reply sir, sorry sir one thing i forget to tell, in this sheet the word or number is link from another sheet by formulae which was cannot find by excel microsoft by Ctrl+F key.
 
Upvote 0
"word or number is link from another sheet by formulae"
can you give example
 
Upvote 0
"word or number is link from another sheet by formulae"
can you give example
In Sheet 1 have data is upto 1500 rows and in sheet 2 i link the data from various cells for example =Sheet1!A1&" "&Sheet1!B1 like that. i want to find the word in sheet 2 by command button.

Sheet 1


A
B
C
1
125
ABC
XYZ
2
205
MNP
235

<tbody>
</tbody>




sheet 2

A
B
C
1
=Sheet1!A1&" "&Sheet1!B1
=Sheet1!A1&" "&Sheet1!C1

2




<tbody>
</tbody>

sheet 2 Result is as follows


A
B
C
1
12 5 ABC
125 XYZ

2




<tbody>
</tbody>


like that, so i want to find a word ABC or any number in Sheet 2, which is not possible by doing ctrl+f
I think it is clear.
Thanks again for your reply.
 
Last edited:
Upvote 0
Yes it is clear now, try next code.
As soon a cell contains the word to find, this cell is selected
Note: It's working in the active sheet
You could assign a shortcut key to the macro (e.g. f) and use Control + f to launch the macro
Code:
Sub SearhStg()
Dim WkStg
Dim F  As Range
Dim WkRg  As Range
    WkStg = Application.InputBox("What is the word to search ? =")
    Set WkRg = ActiveSheet.UsedRange
    For Each F In WkRg
        If (Len(F.Value) - Len(Replace(F.Value, WkStg, "")) <> 0) Then
            F.Select
            Exit For
        End If
    Next
End Sub
 
Upvote 0
Yes it is clear now, try next code.
As soon a cell contains the word to find, this cell is selected
Note: It's working in the active sheet
You could assign a shortcut key to the macro (e.g. f) and use Control + f to launch the macro
Code:
Thanks sir it works perfectly. thanks once again for giving your valuable time
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,181
Members
448,871
Latest member
hengshankouniuniu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top