Forum Discussion
Andy Johnston
Sep 15, 2017Copper Contributor
RowSource Syntax in a Form ComboBox
I am using the following successfully to validate a form combo box [using the "RowSource" parameter] against a table on a work sheet with a single column :- LookupData!Table_Query_from_harglive9 Do...
- Sep 18, 2017Generally speaking using the RowSource to fill a combobox on a userform is frowned upon. I always write the data to the combobox using the List property directly, e.g.:
ComboBox1.List = Worksheets("YourSheet").Range("TheNamedRange").Value
Note that it is also a good idea to name the range you are intending to use as the rowsource.
JKPieterse
Sep 18, 2017Silver Contributor
Generally speaking using the RowSource to fill a combobox on a userform is frowned upon. I always write the data to the combobox using the List property directly, e.g.:
ComboBox1.List = Worksheets("YourSheet").Range("TheNamedRange").Value
Note that it is also a good idea to name the range you are intending to use as the rowsource.
ComboBox1.List = Worksheets("YourSheet").Range("TheNamedRange").Value
Note that it is also a good idea to name the range you are intending to use as the rowsource.
- Ahmed_SaadJul 04, 2020Copper Contributor
thanks for the tip, but how can i make the listbox updated at the same time JKPieterse
- Andy JohnstonSep 19, 2017Copper Contributor
Many thanks for the information Jan.
Your solution works well.
Just to point out I got it working like you implied, by naming the table column and then refering to this in the "RowSource" property. Can you explain why using the "Row Source" is frowned upon, as opposed to your method.
Thanks Again Andy.
- JKPieterseSep 20, 2017Silver ContributorBecause it is
a. Unstable (i've seen problems with userforms using the rowsource)
b. Error prone (the rowsource property does not change when you insert or delete cells).
Inserting and deleting cells will only keep working if you use a range name as those adjust themselves.