Drop down list - auto fill capability?

frateg8r

Board Regular
Joined
Mar 2, 2005
Messages
221
Office Version
  1. 365
Platform
  1. Windows
I have a drop down list in a cell; it currently has 800+ items in the list, so finding one can be time consuming (relatively speaking.) My specialty app programmer has created a way to enter 4-5 characters in a field, press enter, and it pulls up the first 10 matching items. He calls this an "auto fill" feature, for lack of a better name when put on the spot to identify it in a technical way just a moment ago.

I'd like to be able to do something similar in my Excel workbook. For example, in the cell, type in "CNABC" and have the list go to the first or nearest match, so that I can then select that first item or scroll up/down as I normally would.

I'm pretty sure I saw somebody else post on a similar question, but that was over a year ago, and I have no idea what keywords to use to search on it, except "drop down", and well, that could take months looking through all those.

Thanks in advance, as always, to you XL whizzes out there!

XL2003 ON WIN7
 
Last edited:

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Excel does this automatically. When you have a list in alpha order, you can type in the first letter or more letters and when you click on the down arrow for the list, you will now have a listing with those first few letters.

Example if your list is
CEO
Clerk
Programmer
Project Manager

If you type in Pro then click the down arrow, you will see only Programmer and Project Manager.

HTH
 
Upvote 0
Excel does this automatically. When you have a list in alpha order, you can type in the first letter or more letters and when you click on the down arrow for the list, you will now have a listing with those first few letters.

I've tried this with both Excel 2003 & Excel 2007 - it does not work in either. Is there a setting I need to adjust?
 
Upvote 0
To be quite honest not sure. I have only ever used data validation, but not ever messed with combo boxes. Sorry...
 
Upvote 0
Jeff - thanks! That was the trick, and unbelievably easy to implement for my needs. However, one final question - can't seem to tab/enter out of the combo box, which of course makes routine data entry much easier. Any suggestions?


Did you add in the last part of the code from the website? I've used it before and works great.

Code:
'====================================
'Optional code to move to next cell if Tab or Enter are pressed
'from code by Ted Lanham
Private Sub TempCombo_KeyDown(ByVal _
        KeyCode As MSForms.ReturnInteger, _
        ByVal Shift As Integer)
    Select Case KeyCode
        Case 9 'Tab 
            ActiveCell.Offset(0, 1).Activate
        Case 13 'Enter 
            ActiveCell.Offset(1, 0).Activate
        Case Else
            'do nothing
    End Select
End Sub
'====================================
 
Upvote 0
Hello all I was trying to accomplish the same thing, I foolowed the instructions on the below link, but I have my source names on a different sheet, so it isnt working. I am trying to auto fill a drop down data validation box that I already created with this code:

Code:
Option Explicit
' Developed by Contextures Inc.
' [URL="http://www.contextures.com"]www.contextures.com[/URL]
Private Sub DriversList_KeyDown(ByVal _
        KeyCode As MSForms.ReturnInteger, _
        ByVal Shift As Integer)
    'Hide combo box and move to next cell on Enter and Tab
    Select Case KeyCode
        Case 9
            ActiveCell.Offset(0, 1).Activate
        Case 13
            ActiveCell.Offset(1, 0).Activate
        Case Else
            'do nothing
    End Select
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim str As String
Dim cboTemp As OLEObject
Dim ws As Worksheet
Set ws = ActiveSheet
On Error GoTo errHandler
If Target.Validation.Type = 3 Then
Cancel = True
End If
Set cboTemp = ws.OLEObjects("DriversList")
  On Error Resume Next
  With cboTemp
    .ListFillRange = ""
    .LinkedCell = ""
    .Visible = False
  End With
On Error GoTo errHandler
  If Target.Validation.Type = 3 Then
    Application.EnableEvents = False
    str = Target.Validation.Formula1
    str = Right(str, Len(str) - 1)
    With cboTemp
      .Visible = True
      .Left = Target.Left
      .Top = Target.Top
      .Width = Target.Width + 15
      .Height = Target.Height + 5
      .ListFillRange = ws.Range(str).Address
      .LinkedCell = Target.Address
    End With
    cboTemp.Activate
  End If
  
errHandler:
  Application.EnableEvents = True
  Exit Sub
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim str As String
Dim cboTemp As OLEObject
Dim ws As Worksheet
Set ws = ActiveSheet
Set cboTemp = ws.OLEObjects("DriversList")
  On Error Resume Next
If cboTemp.Visible = True Then
  With cboTemp
    .Top = 10
    .Left = 10
    .ListFillRange = ""
    .LinkedCell = ""
    .Visible = False
    .Value = ""
  End With
End If
errHandler:
  Application.EnableEvents = True
  Exit Sub
End Sub



 
Last edited:
Upvote 0
When I create The Data Valadation source on the same sheet it works fine, but I have all source info on a different sheet
 
Upvote 0

Forum statistics

Threads
1,215,053
Messages
6,122,882
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top