how to modify the code so that when i select the name from the listbox the listbox should hide.

Martin helped me with question i had how to do this Excel search box Soundex Search.

attached is the solution.

when i click a name from the listbox it should hide the listbox and if i click again in the textbox to search for new value the listbox should show.

how can i make this toggle work?

Flora EdwardsMedicineAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saqib Husain, SyedEngineerCommented:
To the sheet2 module Add
Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
ActiveSheet.ListBoxes("List Box 2").Visible = True
End Sub

Open in new window

and in the Sub ListBox2_Change() add at the end
ActiveSheet.ListBoxes("List Box 2").Visible = False

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Flora EdwardsMedicineAuthor Commented:
thank you very much Saqib. perfect solution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.