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!
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,297
Doing that is not possible
You can use the up/down key to scroll the list without using the mouse.
 

tybaltlives

Active Member
Joined
Nov 6, 2006
Messages
414
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:

<b>Excel 2010</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #BBB"><colgroup><col width="25px" style="background-color: #DAE7F5" /><col /></colgroup><thead><tr style=" background-color: #DAE7F5;text-align: center;color: #161120"><th></th><th>A</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="font-weight: bold;;">Code to activate user form with double click on any cell</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";">Private Sub Worksheet_beforedoubleclick(ByVal Target As Range, cancel As Boolean)</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style=";"> If Not Intersect(Target, Range(ActiveCell, ActiveCell)) Is Nothing Then ' reacts to double clicking on any cell</td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style=";">    Userform2.ComboBox1.RowSource = "Data_list" ' use a named range:  should be in sorted order (small to large or A to B)</td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style=";">    </td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style=";">' centers userform2 if multiple screens</td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style=";"> With Userform2</td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style=";">  .StartUpPosition = 0</td></tr><tr ><td style="color: #161120;text-align: center;">9</td><td style=";">  .Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)</td></tr><tr ><td style="color: #161120;text-align: center;">10</td><td style=";">  .Top = Application.Top + (0.3 * Application.Height) - (0.1 * .Height)</td></tr><tr ><td style="color: #161120;text-align: center;">11</td><td style=";">  .Show</td></tr><tr ><td style="color: #161120;text-align: center;">12</td><td style=";"> End With</td></tr><tr ><td style="color: #161120;text-align: center;">13</td><td style=";">     </td></tr><tr ><td style="color: #161120;text-align: center;">14</td><td style=";">End If</td></tr><tr ><td style="color: #161120;text-align: center;">15</td><td style=";">End Sub</td></tr><tr ><td style="color: #161120;text-align: center;">16</td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">17</td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">18</td><td style="font-weight: bold;;">Code if combobox1 is clicked</td></tr><tr ><td style="color: #161120;text-align: center;">19</td><td style=";">Private Sub ComboBox1_click()</td></tr><tr ><td style="color: #161120;text-align: center;">20</td><td style=";">DoEvents</td></tr><tr ><td style="color: #161120;text-align: center;">21</td><td style=";">ActiveCell.Value = ComboBox1.Value</td></tr><tr ><td style="color: #161120;text-align: center;">22</td><td style=";">Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(1, 0)).Select</td></tr><tr ><td style="color: #161120;text-align: center;">23</td><td style=";">Unload Me</td></tr><tr ><td style="color: #161120;text-align: center;">24</td><td style=";">End Sub</td></tr></tbody></table><p style="width:7.2em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #BBB;border-top:none;text-align: center;background-color: #DAE7F5;color: #161120">single entry</p><br /><br />
 
Last edited:

tybaltlives

Active Member
Joined
Nov 6, 2006
Messages
414
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?
 

Forum statistics

Threads
1,082,389
Messages
5,365,161
Members
400,827
Latest member
Mitzescu

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top