How to Apply Excel Combo Box Autocomplete to a Specific Data Validation List
Question details
Restrict an Excel VBA combo box with autocomplete to work only on a specific cell or range instead of all data validation cells.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- A user has implemented an Excel VBA combo box to enable autocomplete for data validation drop-down lists.
- Observed behavior
- The VBA code checks only the validation type, causing the combo box to appear on every validated cell across the worksheet instead of the intended specific range.
Ensure your Excel workbook is saved as a Macro-Enabled Workbook (.xlsm) and that you know the exact cell address or range where you want the autocomplete feature to appear.
Restrict Autocomplete to a Specific Range using VBA Intersect
Use the Intersect method in VBA to ensure the combo box only triggers within a designated range of cells.
By default, checking only for the data validation type will apply your macro to any drop-down list on the sheet. Using the Intersect function allows you to isolate the behavior to a specific block of cells.
Press ALT + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.
In the Project Explorer panel on the left, find and double-click the specific Worksheet object that contains your drop-down list.
Find the worksheet selection change event containing `If Target.Validation.Type = 3 Then`. Replace this line with `If Not Intersect(Target, Range("B2:B10")) Is Nothing And Target.Validation.Type = 3 Then`.
Change the `"B2:B10"` string in the code to match the actual range where you want the combo box to appear.
Save the VBA code, return to your Excel worksheet, and click on cells inside and outside the specified range to ensure the combo box only appears where intended.

Restrict Autocomplete to a Single Specific Cell
Modify the target address condition in VBA if your data validation drop-down is limited to just one individual cell.
Use WPS Spreadsheet to Manage Data Validation and Macros Easily
WPS Office provides robust support for advanced spreadsheet functions, including data validation and VBA macros. You can easily apply and manage custom drop-down lists with autocomplete functionality using a familiar and lightweight interface.
- 1. Open Your Workbook in WPS Spreadsheet: Download and launch WPS Office, then open your macro-enabled spreadsheet (.xlsm).
- 2. Set Up Data Validation: Go to the 'Data' tab and select 'Validation' to configure your standard drop-down lists in your desired cells.
- 3. Access the VBA Editor: Navigate to the 'Developer' tab and click 'Visual Basic Editor' to access the macro coding environment.
- 4. Apply Range Limitations: Paste your combo box autocomplete code into the sheet object and update the target range to easily restrict its behavior.

Frequently Asked Questions
Why does my Excel combo box appear on every cell?
This happens when the VBA code relies solely on checking if the clicked cell has data validation applied (using `Target.Validation.Type = 3`). Without specifying a range condition, the macro triggers on any validated cell across the entire worksheet.
How do I change the name of the combo box in my VBA code?
You can update the combo box reference by modifying the line `Set xCombox = xWs.OLEObjects("Combo1")` in your VBA script. Replace "Combo1" with the exact name of the combo box control you inserted onto your worksheet.
Can I apply this VBA autocomplete to multiple non-contiguous columns?
Yes. You can modify the `Intersect` range in the VBA code to include multiple areas separated by commas, such as `Range("B2:B10, D2:D10")`. This ensures the combo box triggers across all specified cell blocks while ignoring the rest of the sheet.




