Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Search Listbox Values

I have a TextBox and a ListBox. My question is Is there a way to
search through the values in the listbox to see if the value entered
in the textbox exists in the Listbox?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Search Listbox Values

here's one way:

Sub test()
Dim i As Integer

For i = 0 To ListBox1.ListCount - 1
If TextBox1.Text = ListBox1.List(i) Then
MsgBox TextBox1.Text & " exists in listbox"
Exit Sub
End If
Next i

MsgBox TextBox1.Text & " does not exist in listbox"

End Sub


--
Hope that helps.

Vergel Adriano


" wrote:

I have a TextBox and a ListBox. My question is Is there a way to
search through the values in the listbox to see if the value entered
in the textbox exists in the Listbox?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Search Listbox Values

Thats what I was looking for thanks for you help Vergel

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 to search and display results in multicolumn listbox [email protected] Excel Programming 6 February 7th 07 01:32 AM
Listbox Search Function Brian C Excel Programming 0 March 13th 06 07:00 PM
Listbox value return from search Mcat Excel Programming 3 November 30th 05 10:04 PM
Fill values into a listbox matching selected values from a combobox Jon[_19_] Excel Programming 4 January 25th 05 04:25 PM
Sorting ListBox results or transposing ListBox values to other cells for sorting Rob[_8_] Excel Programming 1 July 9th 03 04:35 AM


All times are GMT +1. The time now is 02:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"