Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default VBA search code

Hi there!
Would like to have a UDF / VBA code for a pragmatic search engine

Plan1 - The search criterions
Plan2 - My database. Here I have, among some columns, one named "Location"
and another one named "Port Code".
Plan3 - Blank. Here I'd like to have the search results.

In some extents, what I need is:

To have on Plan1 two text boxes (on B1 and B2, for instance) where I can
type what I want to look for.
Either I want to know what is the location code for the port of New York,
then I type "New York" on B1
Or I have a port code and want to know what "USNYC" stands for, I type it on
B2

So, when I have typed the condition I want (either Location or Port Code), I
click OK button, Excel looks for the data on my database on Plan2 and brings
all the results on Plan3.
I'd like also to have all the results in case I type only a part of a name,
i.e., if I type "Charl", I need to have as result: Charles, Charleston,
Charlotte, Saint Charles, Cape Charles...

Is it possible?
Please advise if you need further clarification.

Thanks a bunch,
Gustavo



  #2   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default VBA search code

Gustavo:

I have a search macro that runs through every row looking for a text string.
In my macro, the row is hidden if it doesn't find the string. It finds
partial strings as well. I use:
Set myFind = Rows(i).Find(What:=myTarget, LookAt:=xlPart)
If myFind Is Nothing Then
Selection.EntireRow.Hidden = True
End If
where myFind is a Range object and myTarget is the contents of a cell.

If you change the return to
If Not myFind Is Nothing Then
then you'll be able to do something with the result.

HTH
Ed

"Gustavo Strabeli" wrote in message
...
Hi there!
Would like to have a UDF / VBA code for a pragmatic search engine

Plan1 - The search criterions
Plan2 - My database. Here I have, among some columns, one named "Location"
and another one named "Port Code".
Plan3 - Blank. Here I'd like to have the search results.

In some extents, what I need is:

To have on Plan1 two text boxes (on B1 and B2, for instance) where I can
type what I want to look for.
Either I want to know what is the location code for the port of New York,
then I type "New York" on B1
Or I have a port code and want to know what "USNYC" stands for, I type it
on
B2

So, when I have typed the condition I want (either Location or Port Code),
I
click OK button, Excel looks for the data on my database on Plan2 and
brings
all the results on Plan3.
I'd like also to have all the results in case I type only a part of a
name,
i.e., if I type "Charl", I need to have as result: Charles, Charleston,
Charlotte, Saint Charles, Cape Charles...

Is it possible?
Please advise if you need further clarification.

Thanks a bunch,
Gustavo





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
VBA code for search button Dylan @ UAFC[_2_] Excel Worksheet Functions 3 November 25th 08 10:59 PM
Search Code Soniya Excel Programming 3 October 18th 04 12:49 PM
Excel XP VBA code to search all macro code in Excel module for specific search string criteria Ed[_18_] Excel Programming 4 May 20th 04 02:08 PM
Excel XP VBA code to search all macro code in Excel module for specific search string criteria Frank Kabel Excel Programming 0 May 19th 04 08:11 PM
Search code Bourbon[_7_] Excel Programming 2 January 10th 04 06:14 PM


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