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

I have a combobox with a large number of entries representing supplier invoice numbers.

I would like to filter the dropdown list as data is entered into the text box. For example, if the user enters 23 in the text box then only invoices starting with with 23 would show up in the dropdown.

I thought of clearing & repopulating the combobox for each digit as the textbox is entered but I cant work out how to return just the entered digits (without the complete first matched record). In any case, there may be a much simpler and more effective solution.

Hope this makes sense. Running Excel 2010.

Thanks in advance.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Combobox filtering

Hi Neil,

Am Tue, 11 Mar 2014 08:17:05 +0100 schrieb Claus Busch:

if you start the userform fill the combobox with all values (in my
example the values are in Sheet1 Range("Z1:Z50")


a little bit easier:

Private Sub TextBox1_Change()
Dim myArr As Variant
Dim i As Long

myArr = Sheets("Sheet1").Range("Z1:Z50")

With UserForm1
If Not IsNumeric(.TextBox1.Value) Then
MsgBox "Please enter a number"
Exit Sub
End If
If CLng(.TextBox1.Value) < UBound(myArr) Then
.ComboBox1.RowSource = ""
For i = CLng(.TextBox1.Value) To UBound(myArr)
.ComboBox1.AddItem myArr(i, 1)
Next
.ComboBox1.ListIndex = 0
End If
End With
End Sub

Private Sub UserForm_Initialize()
If Me.TextBox1.Value = "" Then
Me.ComboBox1.RowSource = "Sheet1!Z1:Z50"
End If
End Sub


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
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
ComboBox Form for CrossTab Query filtering AFSSkier Excel Programming 0 July 20th 06 08:16 PM
Filtering and coping w/combobox sebastianmur Excel Programming 0 October 13th 05 03:05 PM
trouble filtering a list. Why isn't column filtering? Pat Excel Worksheet Functions 1 July 18th 05 03:30 PM
Filtering Values using a Combobox teresa Excel Programming 2 December 1st 04 01:20 AM
Filtering ComboBox shrekut[_3_] Excel Programming 2 January 15th 04 02:09 PM


All times are GMT +1. The time now is 04:42 AM.

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"