View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
AJ Master AJ Master is offline
external usenet poster
 
Posts: 29
Default Loop Through Combo Boxes on Worksheet and in Workbook

On Jan 3, 3:10 pm, Vergel Adriano
wrote:
Assuming you're using the combo box from the Forms Toolbar, and assuming that
the combo boxes you're interested in are using the same Input Range, you can
try something like this:

Sub test()
Dim dropdown As Object

For Each dropdown In Worksheets("Sheet1").DropDowns
If dropdown.ListFillRange = "Sheet2!$A$1:$A$10" Then
MsgBox "Do something"
End If
Next dropdown
End Sub

--
Hope that helps.

Vergel Adriano

"AJ Master" wrote:
I have created a workbook that compares 3 scenarios for cost
sensitivity. Each workbook has 3 worksheets with 8 combo boxes each
and a summary worksheet. For example, on worksheet 1 combo boxes 1,
3, 5, and 7 all have the same list population. This would be same for
worksheet 2 and 3 as well. Can anyone show me how to loop through
combo boxes 1, 3, 5, 7 and then do the same on worksheets 2 and 3? I
know the hard way, but is there a simpler way?


Also, if it helps the list population in each combo box are the years
1995 to 2020.


Thanks...AJ


Vergel,

I am using the combo box from the control toolbox toolbar. My
previous experience with using the "ListFillRange" has not been good
as I've found excel behaves quite strangely when using this. This is
why I populate the combo box through vba. I know that others
including Tom Ogilvy have commented about this issue and the work
around seems to be to avoid the "ListFillRange". I have written an
array to fill the combo boxes but I need help to populate only
Combobox1, Combobox3, Combobox5 and Combobox7 on worksheet 2. I then
need to do the same for worksheet 3 and worksheet 4 (e.g. "sheet2",
"sheet3", "sheet4"...and these are the names in vba not on the tab.

Thanks.....AJ