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
Does anybody know how to alter this to specify a specific column when the Table has more than one column. Either defining Column number or Name to be used. Tried numerous syntax but none work.
EG LookupData!Table_Query_from_harglive9[Column Name] etc.
[Apologies if duplicated but last post seems to have disappeared]
Many thanks.
DavidAz81 I believe I had the same issue using the code found at https://stackoverflow.com/questions/43923102/hover-preview-over-excel-image-link . I had the same problem until a saw a comment when they explained the updated reference. The solution is simple. first use the hyperlink function in your language, but more than this, you need to correct the cell code. in the original post it was "=HYPERLINK(OnMouseOver("http://i.imgur.com/rQ5G8sZ.jpg"),"http://i.imgur.com/rQ5G8sZ.jpg")" but it should be changed to =HYPERLINK(OnMouseOver("http://i.imgur.com/rQ5G8sZ.jpg";A1); "http://i.imgur.com/rQ5G8sZ.jpg")
Any way, i did use it like this. On A column i have the list of hyperlinks (in text such as https://sitename.com/filename.jpg) (A2 is the first image), on B column I use this formula (on B2) I have =HYPERLINK(OnMouseOver(A2;B2);A2) on C column the =HYPERLINK(Reset()) .
in this sample I used the same image link on all cells (lazy me) but it works. . anyway, it is not the best solution yet. I am working on other easier way. this is a screenshot of the sample.
Hope it helps someone.. . the real advantage in this one is that you do not save all pictures in the excel file, as you say, if your list is large it would not be practical, but I think there must be a better way. i have included the sample file, but in case you don't want to download a unknown file, just follow the instructions.
4 Replies
Sort By
- JKPieterseSilver ContributorGenerally 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.- Ahmed_SaadCopper Contributor
thanks for the tip, but how can i make the listbox updated at the same time JKPieterse
- Andy JohnstonCopper 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.
- JKPieterseSilver 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.