Indirect Function and Combobox (in worksheet)

Bungraman

Board Regular
Joined
May 26, 2010
Messages
126
Hi, I have done some searching and found one thread directly relating to my problem, but the solution in the thread lies in a broken link, so I apologize if I am doubling up here.

My problem is, I know the INDIRECT function will not work with a Combobox on a worksheet. So I wish to populate the combobox list referenced from a cell that contains the "named range" title inside. This cell will change the "named range" dependant on values of other cells.

For example (thinking outside the square):

The Combobox is positioned and referenced to "D6". The cell containing the "named range" title is "AC6". This cell (AC6) changes dynamically dependant on other cell values (through vlookup). How do I go about getting the Combobox to list the values from the named range shown in "AC6"? Also can this be done accross multiple rows, from row 6 to 25, as individual comboboxes on each row (ie D6, D7, D8 .... D25)?

Thanks

Bungra
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Before anything else, what is the reason that you aren't using Data Validation and In-Cell drop-downs for this?
 
Upvote 0
Hi Glenn,

Before anything else, what is the reason that you aren't using Data Validation and In-Cell drop-downs for this?

The reason for using a ComboBox was because a Data Validation drop-down list does not allow auto-fill/complete. One list that I have which is pertinent to this combobox has over 2000 entries to be listed so it would be good to type out a couple of letters to get to your selection.

Thanks
Bungra
 
Upvote 0
... To clarify further, I would like the combobox to use the value in the cell, which happens to be a named range, to display the list. All attempts at this have ended with just the named range being displayed in the dropdown list (one value) not any of the values actually from the named range.

Should I be using the OFFSET or ADDRESS function anywhere to make this work as I have seen elsewhere on the web, I have absolutely no idea, because using them doesn't make sense. :confused:

Is it a simple case of coding to enable a reference from the cell to the combobox, and coding the combobox to read the value from the cell as a named range??? I am lost. Surely there is a easy solution.

Please there must be someone out there that can help.....

Regards
 
Upvote 0
It'd be something like this, in the sheet code area ( right-click sheet tab, and choose View Code ):
Code:
Private Sub ComboBox1_GotFocus()

ComboBox1.ListFillRange = ""
On Error Resume Next
ComboBox1.ListFillRange = Range(Range("A2").Value).Address

End Sub
... changing A2 to be the cell that contains the name of the range.
 
Upvote 0
Thanks Glenn,

I placed the code in the sheet concerned as said, and nothing happened, so I thought your "A2" should have been my "AC6" (named range) cell, and also nothing happened, should I be doing anything else? or missing something?

FYI, the combobox object is named ComboBox1, and number format of cell "AC6" is general.

Regards

Bungra
 
Upvote 0
Hi Glenn, I thought you had abandoned the post.

The contents of AC6 is a general format cell that has the name of a "named range". This name varies depending on other formulas. The ComboBox is to recognise the contents of AC6 as a named range, and then list the contents of that named range in the combobox listing.

Does that make sense?

Regards
 
Upvote 0
It sounds like the code should work ... did you try putting a breakpoint in to see if the code triggers?
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,834
Members
452,947
Latest member
Gerry_F

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