A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Search Macro



 
 
Thread Tools Display Modes
  #1  
Old April 21st, 2010, 11:22 AM posted to microsoft.public.excel.worksheet.functions
Eán[_2_]
external usenet poster
 
Posts: 30
Default Search Macro

Is there a macro of function I can use to find key words or statements on a
worksheet, similat to the Find (goggles) icon?

Many thanks.

  #2  
Old April 21st, 2010, 12:09 PM posted to microsoft.public.excel.worksheet.functions
Jacob Skaria
external usenet poster
 
Posts: 5,952
Default Search Macro

Try the below...If you are looking for a whole cell match; then change LookAt
to xlWhole

Sub Macro()

Dim varFound As Variant, varSearch As Variant

varSearch = InputBox("Find string")
Set varFound = Cells.Find(varSearch, LookIn:=xlValues, LookAt:=xlPart)
If Not varFound Is Nothing Then
varFound.Activate
End If

End Sub


--
Jacob (MVP - Excel)


"Eán" wrote:

Is there a macro of function I can use to find key words or statements on a
worksheet, similat to the Find (goggles) icon?

Many thanks.

  #3  
Old April 21st, 2010, 02:07 PM posted to microsoft.public.excel.worksheet.functions
Eán[_2_]
external usenet poster
 
Posts: 30
Default Search Macro - Command Button

How can I do this using the Command Button?

"Jacob Skaria" wrote:

Try the below...If you are looking for a whole cell match; then change LookAt
to xlWhole

Sub Macro()

Dim varFound As Variant, varSearch As Variant

varSearch = InputBox("Find string")
Set varFound = Cells.Find(varSearch, LookIn:=xlValues, LookAt:=xlPart)
If Not varFound Is Nothing Then
varFound.Activate
End If

End Sub


--
Jacob (MVP - Excel)


"Eán" wrote:

Is there a macro of function I can use to find key words or statements on a
worksheet, similat to the Find (goggles) icon?

Many thanks.

  #4  
Old April 21st, 2010, 02:51 PM posted to microsoft.public.excel.worksheet.functions
Jacob Skaria
external usenet poster
 
Posts: 5,952
Default Search Macro - Command Button

--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.

From menu ViewToolbarsForms drag a button control to the worksheet. and
select the macro to be assigned....

--
Jacob (MVP - Excel)


"Eán" wrote:

How can I do this using the Command Button?

"Jacob Skaria" wrote:

Try the below...If you are looking for a whole cell match; then change LookAt
to xlWhole

Sub Macro()

Dim varFound As Variant, varSearch As Variant

varSearch = InputBox("Find string")
Set varFound = Cells.Find(varSearch, LookIn:=xlValues, LookAt:=xlPart)
If Not varFound Is Nothing Then
varFound.Activate
End If

End Sub


--
Jacob (MVP - Excel)


"Eán" wrote:

Is there a macro of function I can use to find key words or statements on a
worksheet, similat to the Find (goggles) icon?

Many thanks.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:06 PM.


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