combobox searchable

ZTK

Board Regular
Joined
Aug 20, 2021
Messages
51
Office Version
  1. 2019
Platform
  1. Windows
Again requesting your help .......

I found a macro for drop-down lists, it works perfect for me as it creates the combobox in any "simple" drop-down list so there is no need to copy it manually.


I would like the combobox to have the search function, to filter the possible texts to use.

I show you the macro I use:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)

'Update by Extendoffice: 2020/05/19

Dim xCombox As OLEObject

Dim xStr As String

Dim xWs As Worksheet

Dim xArr



Set xWs = Application.ActiveSheet

On Error Resume Next

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

Set xCombox = xWs.OLEObjects("TempCombo")

With xCombox

.ListFillRange = ""

.LinkedCell = ""

.Visible = False

End With

With xCombox

.Visible = False

.Left = Target.Left

.Top = Target.Top

.Width = Target.Width + 3

.Height = Target.Height + 3

.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




thanks in advance
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Instead of data validation it's better to use combobox for a searchable data entry process.

Here's an example of a searchable combobox in a single cell:
deCombobox - sheet,1 cell, searchable,filter - example 1.xlsm

If you want a searchable combobox in multiple cells, you can find an example here:
best-way-to-create-a-searchable-drop-down-list-with-auto-complete-functionality-to-cells-in-a-column
check post #2 for explanation & post #109 to download the latest version of the sample workbook.

The code is a bit complex but it's easy to set it up.
Let me know if you're interested in this method.
 
  • Like
Reactions: ZTK
Upvote 0
Gracias por la pronta respuesta.

Por supuesto, si estoy interesado, especialmente necesito que el archivo tenga un cuadro combinado en algunas celdas y, como se agregan filas de la misma manera, se agregan listas desplegables.Las

celdas varían, no están en una sola columna, yo sí. No sé si me entienden o hay una forma de adjuntar mi expediente.
 
Upvote 0
@Fluff sorry.


Thanks for the prompt response.

Of course if I'm interested, I especially need the file to have a combo box in some cells and since rows are added in the same way, dropdown lists are added

. I don't know if they understand me or is there a way to attach my file.
Instead of data validation it's better to use combobox for a searchable data entry process.

Here's an example of a searchable combobox in a single cell:
deCombobox - sheet,1 cell, searchable,filter - example 1.xlsm

If you want a searchable combobox in multiple cells, you can find an example here:
best-way-to-create-a-searchable-drop-down-list-with-auto-complete-functionality-to-cells-in-a-column
check post #2 for explanation & post #109 to download the latest version of the sample workbook.

The code is a bit complex but it's easy to set it up.
Let me know if you're interested in this method.
 
Upvote 0
is there a way to attach my file.
You could upload a sample workbook (without sensitive data) to a sharing site like dropbox.com or google drive. And then share the link here.
 
  • Like
Reactions: ZTK
Upvote 0
You could upload a sample workbook (without sensitive data) to a sharing site like dropbox.com or google drive. And then share the link here.
very well, I uploaded my file to google drive, this is where I want to adapt the search macro.




Thank you again
 
Upvote 0
In your file I can see that you use merged cell almost on whole data range !
Merged cell won't work well with macro, so it's your choice, if you want to apply the searchable combobox as I suggested then you need to remove the merge cells.
Instead of merging cells, you should use "center across selection":

but actually where do you want to apply the searchable combobox ?
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,857
Members
449,051
Latest member
excelquestion515

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