View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
david mcritchie david mcritchie is offline
external usenet poster
 
Posts: 691
Default Best way to search a database to match a last name??

Hi Michael,
Here is an example that brings up an InputBox and you
type in the first letters of the lastname.
http://www.mvps.org/dmcritchie/excel/event.htm#match
using the value from the inputbox.
Rows(Application.Match(val, Range("A2:A65536"), 1)).Offset(1, 0).Activate
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Michael Vaughan" wrote in message ...
Hello Everyone,

I have a array, database with names and addresses. It is located in a sheet
by itself with each cell containing a list of information such as:

A1: Last Name
B1: First Name
C1: Address
D1: Phone number and so on.

I have a userform that I created that lists these addresses one by one by
using a Spinbutton. But, I have so many names in there, I think it would be
better to put in a TextBox so that I can type in "part of the last name" OR
"the last name", and then I click a search button and it will bring up the
Name/Address/Phone No of that person. But, what is the best way to do
that??? Would using the MATCH function be the best.. if so, could you give
me an example of the VBA code for that. Isn't there some webpage that
already has examples of searching a database and bring up the text
displayed?? There has got to be somewhere somebody has already done this???

Thanks in advance.... mv