I have many cbox value to chg would like to use integer to do

G

Guest

I have many combobox's and would like to change there values. Rather than
listing everysingle one in vba I would like to use a interger and have it
cycle through all of the combobox's and update them with a list. Any idea's
how I can write the code.
 
N

Nigel

Use the Controls function on the form, the following illustrates identifying
each control called ComboBox1 to ComboBox3

Dim xControl As Integer
For xControl = 1 To 3
Controls("ComboBox" & xControl).Enabled = False
Next
 
G

Guest

Thanks Nigel but I get a Message stating sub or function undefined for
Controls. Do I have to define Controls and/or is this a macro for a
userform. If I have to define Controls could you let me know how. The
combobox's that I am using are on a sheet. Sometimes I have to import values
from another workbook. The problem I am having is when the values come into
the sheet and hit the combobox's the macro attached to the boxes goes off
shutting excel down because of overload. That is why I need to hit the
combobox's with the values instead. If I input the value into the box
everything is good. I have 175 boxes to input. Hence the need for a macro
that will loop through the boxes. I could write out each in vba I am just
trying to save myself hours of typing.
--
Thanks!
Shane W


Nigel said:
Use the Controls function on the form, the following illustrates identifying
each control called ComboBox1 to ComboBox3

Dim xControl As Integer
For xControl = 1 To 3
Controls("ComboBox" & xControl).Enabled = False
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top