Akuini

Macro to create searchable data validation+combobox

When you double click one of the other cells in columns “B”, “D”, etc, an error message “This value doesn’t match the data validation restrictions defined for this cell.” will pop up and start creating multiples of what was already in the cell when you cancel the error message. Any way to fix that?
When I double-clicked a blank cell in col D and moved the cursor to another cell then the error popped up.
In this case try:
In the other columns (i.e B,D,E), on the data validation Settings tab, check Ignore blank.

In col B, you want to allow multiple entries, so you have to set:
On the Error Alert tab, uncheck mark on "Show error alert after invalid data is entered"
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
When I double-clicked a blank cell in col D and moved the cursor to another cell then the error popped up.
In this case try:
In the other columns (i.e B,D,E), on the data validation Settings tab, check Ignore blank.

In col B, you want to allow multiple entries, so you have to set:
On the Error Alert tab, uncheck mark on "Show error alert after invalid data is entered"
Thanks, I thought I had the error alert already unchecked..

Apologize for all the questions. Just one last one. Right now, the combo box appears to the right of the cell after double clicking. If I want the combo box to appear in the cell that the user selected, what would need to be modified?
 
Thanks, I thought I had the error alert already unchecked..

Apologize for all the questions. Just one last one. Right now, the combo box appears to the right of the cell after double clicking. If I want the combo box to appear in the cell that the user selected, what would need to be modified?
Replace Sub toShowCombobox() with this one:


Rich (BB code):
Sub toShowCombobox()

Dim Target As Range

Set Target = ActiveCell

        With ComboBox1
            .Height = Target.Height + 5
            .Width = Target.Width + 10
            .Top = Target.Top - 2
            .Left = Target.Left
            .Visible = True
            .Activate
        End With

End Sub
 
Replace Sub toShowCombobox() with this one:


Rich (BB code):
Sub toShowCombobox()

Dim Target As Range

Set Target = ActiveCell

        With ComboBox1
            .Height = Target.Height + 5
            .Width = Target.Width + 10
            .Top = Target.Top - 2
            .Left = Target.Left
            .Visible = True
            .Activate
        End With

End Sub
Thank you!

When it comes to selecting an option in the combo box, for it to show up in the cell, you have to hit enter. Is it possible to change the code so the user can just use the cursor to select the item in the searchable list and have it populate the cell, or is the only way for it to work is have them hit enter?
 
Thank you!

When it comes to selecting an option in the combo box, for it to show up in the cell, you have to hit enter. Is it possible to change the code so the user can just use the cursor to select the item in the searchable list and have it populate the cell, or is the only way for it to work is have them hit enter?
Sorry, I don't know how to amend the code to do that.
 
Hi Akuini,
First of all, THANK YOU for coming up with the code that saves many lives :)
I have a huge list of employee names to choose from and scrolling and searching is not working. Hence, I used your code. I did not make any changes. Like Mercer31, I am encountering the same error "Run-time error '424' Object required in macro Sub get_filterX(). This is when I type something in the combo box.

I am also getting an error "comments may appear after end sub end function or end property". My worksheet already has a VBA code that unhides a bunch of columns based on the number entered in cell A3. For confidentiality purposes, I have removed those columns for now but my original file has them. Underneath this, I pasted your code.

Thanks for looking into this.
 

Attachments

  • error1.png
    error1.png
    37.6 KB · Views: 32
  • error2.png
    error2.png
    17.4 KB · Views: 31
  • error3.png
    error3.png
    6.9 KB · Views: 30
Hi Akuini,
First of all, THANK YOU for coming up with the code that saves many lives :)
I have a huge list of employee names to choose from and scrolling and searching is not working. Hence, I used your code. I did not make any changes. Like Mercer31, I am encountering the same error "Run-time error '424' Object required in macro Sub get_filterX(). This is when I type something in the combo box.

I am also getting an error "comments may appear after end sub end function or end property". My worksheet already has a VBA code that unhides a bunch of columns based on the number entered in cell A3. For confidentiality purposes, I have removed those columns for now but my original file has them. Underneath this, I pasted your code.

Thanks for looking into this.
I think I just fixed this. I will test and come and then come back to you
 
I have a huge list of employee names to choose from
How many rows is it? more than 100K?
If you're interested you can try the add-in version of this searchable combobox. A member use it for a list with 350K rows, and I amended the code a bit to meet his/her specific requirement.
With this add-in you don't have use vba, you just need to install it.
Here:

I think I just fixed this. I will test and come and then come back to you
Just let me know if you need helps.
 
How many rows is it? more than 100K?
If you're interested you can try the add-in version of this searchable combobox. A member use it for a list with 350K rows, and I amended the code a bit to meet his/her specific requirement.
With this add-in you don't have use vba, you just need to install it.
Here:


Just let me know if you need helps.
It's probably around 10K. Can I still try the add-in? and will it work for anyone in my team? or does it have to be me? Thanks!
 
It's probably around 10K.
That's fine, you won't experience any lag.
Can I still try the add-in? and will it work for anyone in my team? or does it have to be me? Thanks!
I share it as freeware, so anybody can use it. I'm happy if you & your team like using it. Hope it is useful. :)
I would also like if you can provide feedback to improve its functionality.
 

Forum statistics

Threads
1,223,604
Messages
6,173,312
Members
452,510
Latest member
RCan29

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