View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
kassie
 
Posts: n/a
Default Creating a Search Field?

Insert this code in your Worksheet section. Right click on the sheet name
tab, and select view code.

Private Sub cmdSearch_Click()

Dim vWhat As Variant
On Error GoTo A
vWhat = InputBox("Enter value to search for", "Enter search criteria")
Cells.Find(What:=vWhat, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
A:
MsgBox "String was not found"
Exit Sub
End Sub

In a strategic place on your worksheet, insert a command button, name it
cmdSearch.

Exit design mode, click on the button and an inputbox will appear where you
can enter your search string. When you click on OK, it will find it

"woodman650" wrote:


Hey all,
I was just wondering if there isn't a way to create a search field on a
worksheet? Instead of opening up a "find" command, you just have a text
input, you click a button and the object is highlighted on the page.
Maybe this can be done with macros? Anyone know? thanks a bunch


--
woodman650
------------------------------------------------------------------------
woodman650's Profile: http://www.excelforum.com/member.php...o&userid=26217
View this thread: http://www.excelforum.com/showthread...hreadid=548037