How to autocomplete when typing in Excel drop down list?
If you have a data validation drop down list with large items, you need to scroll up and down in the list just for finding the proper one, or type the whole word into the list box directly. If there is method for allowing to auto complete when typing the first letter in the drop down list, everything will become easier. This tutorial will provide a VBA method to help you achieve it.
Easily create drop-down list with checkboxes in Excel:
The Drop-down List with Check Boxes utility of Kutools for Excel can help you easily create drop-down list with checkboxes in a specified range, current worksheet, current workbook or all opened workbooks based on your needs.
Download the full feature 30-day free trail of Kutools for Excel now!
Please do as follows to make a drop down list autocomplete after typing corresponding letters in the cell.
Firstly, you need to insert a combo box into the worksheet and change its properties.
1. Open the worksheet that contains the drop down list cell you want to make it autocomplete.
2. Before inserting a Combo box, you need to add the Developer tab to the Excel ribbon. If the Developer tab is showing on your ribbon, shift to step 3. Otherwise, do as follows: Click File > Options to open the Options window. In this Excel Options window, click Customize Ribbon in the left pane, check the Developer box, and then click the OK button. See screenshot:
4. Draw a combo box in current worksheet. Right click it and then select Properties from the right-clicking menu.
5. In the Properties dialog box, please replace the original text in the (Name) field with TempCombo.
6. Turn off the Design Mode by clicking Developer > Design Mode.
Then, apply the below VBA code
7. Right click on current sheet tab and click View Code from the context menu. See screenshot:
8. In the opening Microsoft Visual Basic for Applications window, please copy and paste the below VBA code into the worksheet’s Code window.
VBA code: Autocomplete when typing in drop down list
Private Sub Worksheet_SelectionChange(ByVal Target As Range) 'Update by Extendoffice: 2020/01/16 Dim xCombox As OLEObject Dim xStr As String Dim xWs As Worksheet Dim xArr Set xWs = Application.ActiveSheet On Error Resume Next Set xCombox = xWs.OLEObjects("TempCombo") With xCombox .ListFillRange = "" .LinkedCell = "" .Visible = False End With If Target.Validation.Type = 3 Then Target.Validation.InCellDropdown = False Cancel = True xStr = Target.Validation.Formula1 xStr = Right(xStr, Len(xStr) - 1) If xStr = "" Then Exit Sub With xCombox .Visible = True .Left = Target.Left .Top = Target.Top .Width = Target.Width + 5 .Height = Target.Height + 5 .ListFillRange = xStr If .ListFillRange = "" Then xArr = Split(xStr, ",") Me.TempCombo.List = xArr End If .LinkedCell = Target.Address End With xCombox.Activate Me.TempCombo.DropDown End If End Sub Private Sub TempCombo_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) Select Case KeyCode Case 9 Application.ActiveCell.Offset(0, 1).Activate Case 13 Application.ActiveCell.Offset(1, 0).Activate End Select End Sub
9. Press Alt + Q keys simultaneously to close the Microsoft Visual Basic Applications window.
From now on, when click on a drop down list cell, the drop down list will prompt automatically. You can start to type in the letter to make the corresponding item complete automatically in selected cell. See screenshot:
Note: This code does not work for merged cells.