Auto Open, Sheets Array & combobox

EOAEvan

Active Member
Joined
Sep 20, 2007
Messages
399
I am currently using this code to place names in a combobox (active X). How can I use an array to perform each line to all 12 months without repeating the code over and over?

Here is what I have:
Code:
Sub auto_Open()
Sheets("FEB").ComboBox1.List = Array("ALL", "ACT", "ROF", "MM")
Sheets("FEB").ComboBox2.List = Array("ACTvsROF_2", "ACTvsPLN_2", "ACTvsLY_2", "ROFvsMM_2", "ROFvsLM_2", "ROFvsPLN_2", "ROFvsLY_2", "MMvsLM_2", "MMvsPLN_2", "MMvsLY_2")
Sheets("FEB").ComboBox3.List = Array("ACTvsROF_3", "ACTvsPLN_3", "ACTvsLY_3", "ROFvsMM_3", "ROFvsLM_3", "ROFvsPLN_3", "ROFvsLY_3", "MMvsLM_3", "MMvsPLN_3", "MMvsLY_3")
Sheets("FEB").ComboBox4.List = Array("ACTvsROF_4", "ACTvsPLN_4", "ACTvsLY_4", "ROFvsMM_4", "ROFvsLM_4", "ROFvsPLN_4", "ROFvsLY_4", "MMvsLM_4", "MMvsPLN_4", "MMvsLY_4")
Sheets("FEB").ComboBox5.List = Array("ACTvsROF_5", "ACTvsPLN_5", "ACTvsLY_5", "ROFvsMM_5", "ROFvsLM_5", "ROFvsPLN_5", "ROFvsLY_5", "MMvsLM_5", "MMvsPLN_5", "MMvsLY_5")
End Sub

I have tried:
Code:
Sheets(Array("FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC", "JAN")).ComboBox2.List = Array("ACTvsROF_2", "ACTvsPLN_2", "ACTvsLY_2", "ROFvsMM_2", "ROFvsLM_2", "ROFvsPLN_2", "ROFvsLY_2", "MMvsLM_2", "MMvsPLN_2", "MMvsLY_2")
which is giving me a object doesnt support this property or method
and
Code:
Dim ws As Worksheet
    For Each ws In Sheets(Array("FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC", "JAN"))
        With ws
            ComboBox1.List = Array("ALL", "ACT", "ROF", "MM")
        End With
    Next ws

which is giving me object required.
 
Last edited:

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
This got pushed down very quickly and seems it fell through the cracks. Bump!

Thanks for your help!
 
Upvote 0
Bump:

I have been using a work around for this but would like to revisit to see if anyone can suggest how to make this work?

Thanks,
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,147
Members
452,891
Latest member
JUSTOUTOFMYREACH

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