Excel VBA ComBox Box with AutoComplete Search - Excel VBA Searchable Combox - Code Included

This Excel VBA example explains how to create searchable ComboBox with autocomplete feature.
you can get the relevant items as soon as you type in ComboBox and it autocomplete entries basis on matches.
Code is as follows :
Option Explicit
Private Comb_Arrow As Boolean
Private Sub ComboBox1_Change()
Dim i As Long
If Not Comb_Arrow Then
With Me.ComboBox1
.List = Worksheets("Data").Range("A2", Worksheets("Data").Cells(Rows.Count, "A").End(xlUp)).Value
.ListRows = Application.WorksheetFunction.Min(4, .ListCount)
.DropDown
If Len(.Text) Then
For i = .ListCount - 1 To 0 Step -1
If InStr(1, .List(i), .Text, vbTextCompare) = 0 Then .RemoveItem i
Next
.DropDown
End If
End With
End If
End Sub
Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Comb_Arrow = (KeyCode = vbKeyUp) Or (KeyCode = vbKeyDown)
If KeyCode = vbKeyReturn Then Me.ComboBox1.List = Worksheets("Data").Range _
("A2", Worksheets("Data").Cells(Rows.Count, "A").End(xlUp)).Value
End Sub

Пікірлер: 64

  • @kkhalilos
    @kkhalilos8 ай бұрын

    Merci pour cette vidéo, Elle m'a aidé à résoudre plusieurs problème de ma sélection

  • @arunblr2
    @arunblr23 жыл бұрын

    Very good tutorial appreciated. It is very good for beginners, hope to see more. Thanks

  • @ExcelDestination

    @ExcelDestination

    3 жыл бұрын

    thanks a lot!!

  • @johng5295
    @johng52952 жыл бұрын

    Thanks in a million. Great content. Awesome imagination.Grade: A++💥

  • @ExcelDestination

    @ExcelDestination

    2 жыл бұрын

    Our pleasure!

  • @jaimecelorio273
    @jaimecelorio2732 жыл бұрын

    Muchisimas gracias desde "Ecuador"

  • @salehjawhar
    @salehjawhar Жыл бұрын

    it's worked for me, Thank you so muchhhhhhh

  • @sigmatabs9814
    @sigmatabs9814 Жыл бұрын

    Thanks a lot sir, It is very good and it helped me a log.

  • @sunilvaidme
    @sunilvaidmeАй бұрын

    its worl fine, thanks

  • @kartikshanbhag813
    @kartikshanbhag8133 жыл бұрын

    Thanks a lot. Very helpful

  • @ExcelDestination

    @ExcelDestination

    3 жыл бұрын

    welcome

  • @phadil1993
    @phadil19933 жыл бұрын

    Thanks my pro u very good teacher

  • @ExcelDestination

    @ExcelDestination

    3 жыл бұрын

    Glad to hear that

  • @lanzahealinghaircolorcareu8585
    @lanzahealinghaircolorcareu85852 жыл бұрын

    Great Work, But you should add an option after selection to hit enter or tap to go to next cell

  • @lohanbm12
    @lohanbm122 жыл бұрын

    Vídeo excelente!

  • @ExcelDestination

    @ExcelDestination

    2 жыл бұрын

    Thanks

  • @MohAboAbdo
    @MohAboAbdo3 жыл бұрын

    Thank you so mutch, Sir.

  • @ExcelDestination

    @ExcelDestination

    3 жыл бұрын

    You are most welcome

  • @josephkimote661

    @josephkimote661

    2 жыл бұрын

    @@ExcelDestination 👍 Good things here, learning alot. Help me also do this: I have created a vba userform with autocomplete drop-down combobox search creteria but when I search based on a number or date column it is not able to search. It only searches text-data type columns. How can I modify the code to search for numbers, date and text or combination of any of the data types. Your response will be highly appreciated. Thanks in advance

  • @scalemodelstudio
    @scalemodelstudio2 жыл бұрын

    thanks for this man.

  • @ExcelDestination

    @ExcelDestination

    2 жыл бұрын

    welcome

  • @malcolmt3125
    @malcolmt3125Ай бұрын

    This is great and well explained, however I want to use this search facility in a textbox of a userform, can you show me what changed would be made to facilitate this please.

  • @beenay18
    @beenay18 Жыл бұрын

    thanks it worked despite me thinking the referencing might be quite messed up. Can you please explain what the doe is actually doing. and what are those syntaxs or libraries or whatever they are called are working, with examples for each function.

  • @SpeedEcomSolutions
    @SpeedEcomSolutions4 ай бұрын

    Thank Yon Bhai..

  • @alializadeh8195
    @alializadeh81952 жыл бұрын

    مرسی

  • @LiterasiKitabSuci
    @LiterasiKitabSuci5 ай бұрын

    thanks brow

  • @theapexpredator157
    @theapexpredator1573 жыл бұрын

    Thanks for the video, it's helped me quite a bit. I have a few questions too. 1) Is there a way to scroll through the list using the up/down arrow keys without having the Text change in the input field? 2) Is there a shorter line of code to replace the one for the .List? Having to type Worksheets("Data")... is a bit much and I feel like there should be a better way to do it. Maybe with Named Ranges. 3) Is it possible to do a Step Counter of +1 instead of -1? (I get an error when I try to) 4) I don't think this can be fixed, but the .ListRows doesn't update In-Real-Time as one is typing. The unused rows are visible still, but they are greyed out. Thanks again!

  • @user-oz4ko2vw4b

    @user-oz4ko2vw4b

    Жыл бұрын

    هةقص٦ضفيض

  • @ameetmehta8482
    @ameetmehta84827 ай бұрын

    Excellent video and very helpful too. I have couple of queries with this code. Hope you will help me out with that. 1. While we erase out all typed letter in combobox, dropdown list should not be visible. 2. if have two similar names in combobox dropdown list, then keydown does not work. Can you please suggest the solution of the above two queries?

  • @haristeo1964
    @haristeo19642 жыл бұрын

    thanks very muts ......

  • @igorperegrino7779
    @igorperegrino77793 жыл бұрын

    good job!

  • @ExcelDestination

    @ExcelDestination

    3 жыл бұрын

    thank you

  • @GTECHGorakh
    @GTECHGorakh3 жыл бұрын

    hi sir i found error this line plz help If InStr(1, .List(i), .Text, vbTextCompare) = 0 Then

  • @erdianadriani5726
    @erdianadriani57262 жыл бұрын

    Thanks for the video, its help me a lot. Could you explain how to make combobox empty after entry data? Cause I tried this "combobox="" " But combobox always show the list. Thank you

  • @sigmatabs9814
    @sigmatabs9814 Жыл бұрын

    Thanks

  • @indranilsarkar4046
    @indranilsarkar40462 жыл бұрын

    EXCELENT, SIR, I AM VERY VERY THANKFULL TO YOU

  • @ExcelDestination

    @ExcelDestination

    2 жыл бұрын

    You are most welcome

  • @maheshlaxkar7504
    @maheshlaxkar750410 ай бұрын

    Can we filter data automatically using combobox in same destination like textbox.

  • @bonavkr
    @bonavkr3 жыл бұрын

    Hi Sir, Need help, why i get error permission denied ?

  • @spritepot
    @spritepot2 жыл бұрын

    How can I make the actual cells do what the combo box does?

  • @Drum59510
    @Drum595103 жыл бұрын

    Hi, thanks for the video! Could you tell us if you know how to extend the combo box to a whole column?

  • @sadiqulalam8863
    @sadiqulalam8863 Жыл бұрын

    Sir, I have a worksheet. In sheet1, column 'AN' I have a list which is a name range. And I want a drop down list in Sheet3, B5 cell. How can I customize your code? Please help me.

  • @shoeb3818

    @shoeb3818

    4 ай бұрын

    same question here

  • @ehemad
    @ehemad3 ай бұрын

    hello, thanks how would be the code if i want this in a combobox inside o userform, i have spent some time trying to adapt yours but i get multiple errors and i do not know how to continue, help much appreciated

  • @onlineservices6150
    @onlineservices615011 ай бұрын

    Need help It's fantastic but when I type numbers with "/ " like 12/2 it automatically changed into date format like 12/20/2023 and not work backspace to remove year value . Please help 🙏

  • @tczblood
    @tczblood2 жыл бұрын

    When changing to from Change() to Click() or Dropdownlist doesn't work any ideas?

  • @muhanadmawasalkazmeh137
    @muhanadmawasalkazmeh1373 жыл бұрын

    Thank you, can we repeat this combo box in all the cells of the table

  • @ExcelDestination

    @ExcelDestination

    3 жыл бұрын

    yes

  • @akashrajpurohit7542
    @akashrajpurohit754210 ай бұрын

    Sir how to add two columns in combobox and seach accordingly?

  • @BharatKumar-fh7ei
    @BharatKumar-fh7ei3 жыл бұрын

    How to repeat same combo box in same coloum? Say avg 5000 times. If so please guide me to do it.

  • @sabesana1314
    @sabesana13142 жыл бұрын

    literrally did the same way copied created the excel .. still getting error 70 permission denied... where we are going wrong

  • @Denmyocean
    @Denmyocean7 ай бұрын

    How can I see all listed items when pressing down_arrow at the first start of using ComboBox? It shows nothing now. You should type some words before Box stars showing all the items...

  • @VBAGYAN
    @VBAGYAN2 жыл бұрын

    sir what is the code for unique values for VBA ComBox Box with AutoComplete Search please Share

  • @user-it1hd8zl6g
    @user-it1hd8zl6g9 ай бұрын

    Hello Thanks for the video I have 3 lakhs plus item names in excel and want to fetch its correct and unique names from google Can you please suggest me how can I get unique names from google?

  • @mohamedadnan9317
    @mohamedadnan9317 Жыл бұрын

    Hello Sir… really interesting work … I did the same in everything but I have a problem… error 438 … please help… thank you in advance

  • @gopaljakhar7495
    @gopaljakhar74952 жыл бұрын

    If we use indirect formula in drop down list then this coding is't work

  • @rehanluthra1440
    @rehanluthra1440 Жыл бұрын

    Hi, this was a very helpful video. Is it possible to do the same thing combining 2 lists of data on 2 separate worksheets?

  • @indianmonster1445
    @indianmonster14453 жыл бұрын

    wow

  • @ExcelDestination

    @ExcelDestination

    3 жыл бұрын

    thank you

  • @kualisindia735
    @kualisindia735 Жыл бұрын

    can you pls help me with one demo excel

  • @bbddbbful
    @bbddbbful5 ай бұрын

    not working with Userform combox..

  • @romancompasscrete2681
    @romancompasscrete26812 жыл бұрын

    Hello Excel Destination Please can you help me ? I send you by e-mail my file . Couse i truing do from your video but it not working .

  • @badreddinemaati4866
    @badreddinemaati4866 Жыл бұрын

    Not good

  • @dietmarwenz
    @dietmarwenz Жыл бұрын

    Hello, thanks for this great Video! If i click on an Element inside the dropdown, the dropdown collapses and the Combobo don´t show the selected Item. If i Tab out & back in, the selection also disappears. Can you please have a look at my Code? ------------ Private Sub BaseSelect_Enter() ArtikelKat = "BASE" If Len(BaseFilter.Text) Then With BaseSelect .Clear .List = ComboFiltered(ArtikelKat, BaseFilter.Text) .DropDown End With Else With BaseSelect .Clear .List = ComboUnfiltered(ArtikelKat) .DropDown End With End If End Sub ----------- Private Sub BaseSelect_Change() ArtikelKat = "BASE" If Not Comb_Arrow Then With Me.BaseSelect .Clear .List = ComboUnfiltered(ArtikelKat) .DropDown If Len(.Text) Then .Clear .List = ComboFiltered(ArtikelKat, BaseSelect.Text) 'Function to return array with all multi inStr matches from .text entry .DropDown End If End With End If End Sub ------------ Private Sub BaseSelect_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) Comb_Arrow = (KeyCode = vbKeyUp) Or (KeyCode = vbKeyDown) If KeyCode = vbKeyReturn Then Me.BaseSelect.List = ComboFiltered(ArtikelKat, BaseSelect.Text) End Sub -------------- Thanks in Advance! ;)