Dynamic Ranges With Active X Combo Boxes

excelbytes

Active Member
Joined
Dec 11, 2014
Messages
252
Office Version
  1. 365
Platform
  1. Windows
I have an Active X Combo Box and I want the list reference to be dynamic, but it won't allow tables for the ListFillRange. Is there a way to have a dynamic list without using a named range that exceeds the existing list that allows for additions, but generates a lot of blanks at the bottom?
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Is this what you want
VBA Code:
Private Sub ComboBox1_DropButtonClick()
    Me.ComboBox1.List = Sheets("Sheet2").ListObjects("Table1").ListColumns(1).DataBodyRange.Value
End Sub
 
Upvote 0
I'm not sure. I wasn't necessarily anticipating a VBA solution, but that's great if I can get it to work. I entered the code you suggested, adjusting for my specific workbook:

Private Sub ComboBox1_DropButtonClick()
Me.ComboBox1.List = Sheets("Data").ListObjects("Table3").ListColumns(1).DataBodyRange.Value
End Sub

But nothing is showing up in the combo box drop down list. Do I need to enter anything in the ListFillRange box of the Properties for the ComboBox1 for it to work?
 
Upvote 0
But nothing is showing up in the combo box drop down list. Do I need to enter anything in the ListFillRange box of the Properties for the ComboBox1 for it to work?
No - the code provided should do everything
Now we need to work out what is wrong - it will probably be something minor

Where did you put the code?
 
Upvote 0
See the attached.
 

Attachments

  • ComboBox List.png
    ComboBox List.png
    63.8 KB · Views: 45
Upvote 0
Place it in the sheet code window of the sheet containing the combobox
Right-click on the sheet tab \ View Code \ paste the code into that window
 
Upvote 0
I have two combo Boxes on the same worksheet. I did as you suggested and now I get the attached error.
 

Attachments

  • ComboBox List2.png
    ComboBox List2.png
    21.6 KB · Views: 19
Upvote 0
You did not explain which one of your 2 macros failed

Was it ComboBox2_DropButtonClick ?

Rich (BB code):
Me.ComboBox1.List = Sheets("Data").ListObjects("Table2").ListColumns(1).DataBodyRange.Value
Me.ComboBox2.List = Sheets("Data").ListObjects("Table2").ListColumns(1).DataBodyRange.Value
 
Upvote 0
I do not get an error. I need to understand your setup to try to recreate your error

What are the names of your 2 tables?
Are they both on sheet named "Data" ?
Are they single-column tables ?
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,820
Members
449,469
Latest member
Kingwi11y

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