• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Excel Phone Book

Juzar22

Member
I have phone book in excel , Now when i search name it searches only first letter starting name but if i put any letter middle name then it doesn't search anything , can you change VBA code. example file is uploaded.

For example if i want to search John Estiva then the search only shows if we enter first starting word i.e John but if i put Estiva search not showing any result.
 

Attachments

  • Phonebook.xls
    261.5 KB · Views: 18
Hi,

1.JPG

I'm not sure I got the problem... "Estiva" return some results (one of which is John).

Can you double check if it is in fact not working on your end?
 
HI

If you put any thing on search then and hit get contact then i will show up all contents of the phone book. Even if you hit with blank it will show complete contents.
 
Hi,

Ah, I see the problem now...
In the code, you are populating the listbox with all the results from the list in the sheet, regardless of the search string.
In my opinion, what you need to do is loop through all cells of the particular column (depending on the selection on the combobox: Surname, First Name...) and locate the ones that match that search string.
Then, do a "Me.listbox1.AddItem" if the cell's content matches the search string.

Also, with ".AddItem" it may be necessary to clear the listbox first so it doesn't keep adding items to the list each time you click.
 
Back
Top