ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is a search box possible? (https://www.excelbanter.com/excel-programming/367013-search-box-possible.html)

DarklyCute1[_2_]

Is a search box possible?
 

I have pages upon pages of names with data connected to it in different
tables. Is there a way to create a textbox or something of that sort,
that can be used as a search w/o opening find?


--
DarklyCute1
------------------------------------------------------------------------
DarklyCute1's Profile: http://www.excelforum.com/member.php...o&userid=35949
View this thread: http://www.excelforum.com/showthread...hreadid=560810


Tom Ogilvy

Is a search box possible?
 
Turn on the macro recorder, then do Edit=find with an argument that can be
found

turn off the macro recorder

Now look at the code.

You can replace the
. . . cell.Find(what:="constant", . . .

with

. . . cells.find(what:=Textbox1.Text, . . .

or use any variable holding the value to search for

also, instead of

. . . cells.Find(. . .).Activate

use
Dim rng as Range
set rng = cells.find(. . . )
if not rng is nothing then
' rng now holds a reference to the found cell
else
' value wasn't found
end if

Using the Find method does not display the find dialog. Make sure you set
all the parameters appropriately, since many of them are persistent and will
inherit the current setting if you don't specify it. This can cause
inconsistent and mysterious results.

--
Regards,
Tom Ogilvy

"DarklyCute1" wrote:


I have pages upon pages of names with data connected to it in different
tables. Is there a way to create a textbox or something of that sort,
that can be used as a search w/o opening find?


--
DarklyCute1
------------------------------------------------------------------------
DarklyCute1's Profile: http://www.excelforum.com/member.php...o&userid=35949
View this thread: http://www.excelforum.com/showthread...hreadid=560810




All times are GMT +1. The time now is 10:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com