Populate dynamic dropdown in Excel form with VBA -


I have a dropdown on Excel form that I want to populate with the items listed in the sheet "OR", but I Only it needs unique entries from this dynamic list & amp; Then populate the dropdown.

has searched for many blogs, suggested categories are named as a riososource property, but there are duplicate items in my list & amp; Is dynamic.

You can write this code:

  In, the integer as R, integer as NR, wr, v set wr = range ("A1: A10") NR = wr.Rows.Count R = 1 for NR V = wr (R, 1 ) If InStr, V & amp; ",") = 0 then S = S & amp; V & amp; With "," end if next s = left (S, Lane) - 1) range ("D1") Validation Delete. Add type: = xlValidateList, Alertstyle: = xlValidAlertStop, Formula 1: = s End with  

This data uses verification, I think the data combo box in A1: A10 and D1 is. Only A1: A10 will be the specific values ​​in the combo box.

If you like the combobox exchange object, try this:

  as the demat s string, R integer, as NIR integer, Wr = range Set (number "A1: A10") with nr = wr.rows.ComboBox1 Explain for R = 1 nr v = wr (r, 1) If InStr (v, v & amp; ",") = 0 then s = s & amp; V & amp; Next, with "," .AddItem (v) end if  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -