Simple auto populate value from list.

Novice86

New Member
Joined
Jul 18, 2015
Messages
13
I'm looking to use the data validation tool. I'd like user to choose cell value from a very long list. Instead of have to click on the dropdown and scroll to value, how can I have them start typing and have excel auto populate value from list? I'd like to keep the function as simple as possible to prevent issues. Thanks!
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Doing that is not possible
You can use the up/down key to scroll the list without using the mouse.
 
Upvote 0
I've needed to do this as well. The functionality available for a validated data list is very limited. I worked out a way for my programs that allows for similar drop-down functionality by double clicking on any cell using a VBA userform with a single drop-down combobox (you can actually modify the code to allow for several comboboxes if you want).

THe trick is to put the userform activation code in the worksheet (not in a module). The rowsource for the combobox should be a named list and can be as long as you want. If you want to be able to type text into the combobox to search for the closest value the list values should be strings in alphabetical order (numbers should also be listed as strings but you can modify the code to save the string as a number.

Also, you need to make a simple userform with a single combobox in it.

Anyway, if you want to try this out here is some code:


Excel 2010
A
1Code to activate user form with double click on any cell
2Private Sub Worksheet_beforedoubleclick(ByVal Target As Range, cancel As Boolean)
3If Not Intersect(Target, Range(ActiveCell, ActiveCell)) Is Nothing Then ' reacts to double clicking on any cell
4Userform2.ComboBox1.RowSource = "Data_list" ' use a named range: should be in sorted order (small to large or A to B)
5
6' centers userform2 if multiple screens
7With Userform2
8.StartUpPosition = 0
9.Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)
10.Top = Application.Top + (0.3 * Application.Height) - (0.1 * .Height)
11.Show
12End With
13
14End If
15End Sub
16
17
18Code if combobox1 is clicked
19Private Sub ComboBox1_click()
20DoEvents
21ActiveCell.Value = ComboBox1.Value
22Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(1, 0)).Select
23Unload Me
24End Sub
single entry
 
Last edited:
Upvote 0
Ya, inserting an active X combo box into the spreadsheet is another good option. However, I've avoided doing that if I need to share the spreadsheet with others because of a weird resizing bug I've experienced in the past. Anyone else had this happen to them lately?
 
Upvote 0

Forum statistics

Threads
1,212,927
Messages
6,110,700
Members
448,293
Latest member
jin kazuya

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