Editing multiple Combo Boxes at once

Skillie

New Member
Joined
Jul 17, 2014
Messages
16
Hi guys I’m new to the forum. I have average excel experience and know nothing about VB J I’m using Excel 2007.

Here is the issue I want to resolve.

I’ve recently exceeded my abilities by adding approx 400 combo boxes to a sheet; lets call it “sheet1”; manually by copying and pasting the first one I created. Data Validation lists was no use as the text size was too small and only displays 8 lines at a time which made the list awkward to use.

I’ve set the ListFillRange to Sheet2!A2:A160.

I now need to change that range to Sheet2!A2:A300 as the list of data is growing and I foolishly didn’t think of that scenario! I’ve already suffered the agony of manually editing the 500 comboboxes linked cell parameter manually and don’t want to have to do the same every time I wish to change a parameter. The combo boxes are choosing from a list of foods and pulling in their macro nutrient data to a meal menu, 6 meals a day, 10 lines per meal, 7 days which is why I ended up with approx 400+ boxes.

Can anyone advise me of a piece of code and maybe how to run it as I’ve never used VB in excel. I’m sure it’s very simple for all you experts out there! J

Hope that makes sense and thanks for any advice in advance.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi Andrew

thanks for your reply they are active X. they are all named ComboBox1 to ComboBox423. the list i'm choosing from is called "food"

Kind regards

Eddie
 
Last edited:
Upvote 0
Try:

Code:
Sub Combos()
    Dim i As Long
    With Worksheets("Sheet1")
        For i = 1 To 423
            .OLEObjects("ComboBox" & i).ListFillRange = "food"
        Next i
    End With
End Sub
 
Upvote 0
I've created a dynamic named range for the food list now, thank you. ready for the next step to update the ListFillRange in all combos!! :)

I think I will still need to know how to change other parameters from time to time as I tinker with this body of work to get its usability right.
 
Upvote 0
now for example if i wanted to edit the list row length could i use something like this still?

Sub Combos()
Dim i As Long
With Worksheets("Menu week 1")
For i = 1 To 423
.OLEObjects("ComboBox" & i).ListRow = "20"
Next i
End With
End Sub

thanks again
 
Upvote 0

Forum statistics

Threads
1,215,056
Messages
6,122,907
Members
449,096
Latest member
dbomb1414

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