Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Use excel as a searcher

Database isn't definitive. but look at Mr. Erlandsen's site on using ADO

http://www.erlandsendata.no/english/...odao/index.php

--
Regards,
Tom Ogilvy


ims wrote in message
...
Dear all,

I have a database, I want to use excel as a searcher.
By inputting a key word excel will search the whole database and display

all
the records containing this key word.
What's the best and simplest way to do this?
Is there any sample program on the net for my easy reference.
Thanks.

ims




  #2   Report Post  
Posted to microsoft.public.excel.programming
ims ims is offline
external usenet poster
 
Posts: 4
Default Use excel as a searcher

Dear Tom,

What's the meaning of "Database isn't definitive"?
I find the path you given me can't help me a lot.

regards,
ims


"Tom Ogilvy" ¼¶¼g©ó¶l¥ó·s»D
...
Database isn't definitive. but look at Mr. Erlandsen's site on using ADO

http://www.erlandsendata.no/english/...odao/index.php

--
Regards,
Tom Ogilvy


ims wrote in message
...
Dear all,

I have a database, I want to use excel as a searcher.
By inputting a key word excel will search the whole database and display

all
the records containing this key word.
What's the best and simplest way to do this?
Is there any sample program on the net for my easy reference.
Thanks.

ims






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Use excel as a searcher


You could try the following code in a vba module:

First name 2 ranges
"Database" as the cells in you DB
"KeyWord" as a single cell ABOVE your db or on another sheet.


Option Explicit

Sub SearchDB()
Dim oCell As Range
Dim r As Range
Dim Found As Boolean
Dim KWord As String
Dim firstAddress As String

KWord = Range("KeyWord")

For Each r In Range("Database").Rows
Found = False
With r
Set oCell = .Find(KWord, LookIn:=xlValues)
If Not oCell Is Nothing Then
firstAddress = oCell.Address
Do
Found = True
Set oCell = .FindNext(oCell)
Loop While Not oCell Is Nothing And oCell.Address <
firstAddress
End If
If Not Found Then r.EntireRow.Hidden = True

End With
Next


End Sub


TO SHOW YOUR DATABASE again, RightClick all rows in the DBUnhide

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Use excel as a searcher

Saying I have a database really says nothing very useful.

Where is the database. Gocush has assumed it is in an excel spreadsheet. I
have assumed it is external to excel - but even assuming that, where is it -
access, sql server, oracle, something else?

Maybe I should have said the term database is not self defining.

--
Regards,
Tom Ogilvy

"ims" wrote in message
...
Dear Tom,

What's the meaning of "Database isn't definitive"?
I find the path you given me can't help me a lot.

regards,
ims


"Tom Ogilvy" ¼¶¼g©ó¶l¥ó·s»D
...
Database isn't definitive. but look at Mr. Erlandsen's site on using

ADO

http://www.erlandsendata.no/english/...odao/index.php

--
Regards,
Tom Ogilvy


ims wrote in message
...
Dear all,

I have a database, I want to use excel as a searcher.
By inputting a key word excel will search the whole database and

display
all
the records containing this key word.
What's the best and simplest way to do this?
Is there any sample program on the net for my easy reference.
Thanks.

ims








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Use excel as a searcher

dear gocush,

it all the time hides the whole database, don't why....

ims


"gocush" ¦b¶l¥ó
¤¤¼¶¼g...

You could try the following code in a vba module:

First name 2 ranges
"Database" as the cells in you DB
"KeyWord" as a single cell ABOVE your db or on another sheet.


Option Explicit

Sub SearchDB()
Dim oCell As Range
Dim r As Range
Dim Found As Boolean
Dim KWord As String
Dim firstAddress As String

KWord = Range("KeyWord")

For Each r In Range("Database").Rows
Found = False
With r
Set oCell = .Find(KWord, LookIn:=xlValues)
If Not oCell Is Nothing Then
firstAddress = oCell.Address
Do
Found = True
Set oCell = .FindNext(oCell)
Loop While Not oCell Is Nothing And oCell.Address <
firstAddress
End If
If Not Found Then r.EntireRow.Hidden = True

End With
Next


End Sub


TO SHOW YOUR DATABASE again, RightClick all rows in the DBUnhide.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



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
Feild Searcher [email protected] Excel Discussion (Misc queries) 1 March 10th 10 11:51 PM


All times are GMT +1. The time now is 11:35 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"