Controls Array

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can you have an Array of Controls that are located in different Frames on a
UserForm? Here is the code that I have and I am getting an Run Time Error:
Type Mismatch.

For Each Control In Controls(Array("cboAreaP", "cboAreaV", "cboAreaD", _
"cboSingle", "cboDouble",
"cboDebossed"))
With Control
.AddItem "25%"
.AddItem "50%"
.AddItem "75%"
.AddItem "100%"
End With
Next Control
 
Can you have an Array of Controls that are located in different Frames on
a
UserForm? Here is the code that I have and I am getting an Run Time
Error:
Type Mismatch.

For Each Control In Controls(Array("cboAreaP", "cboAreaV", "cboAreaD", _
"cboSingle", "cboDouble",
"cboDebossed"))
With Control
.AddItem "25%"
.AddItem "50%"
.AddItem "75%"
.AddItem "100%"
End With
Next Control

Try your For Each statement this way and see if that works...

For Each Control In Array(cboAreaP, cboAreaV, cboAreaD, _
cboSingle, cboDouble, cboDebossed)

Rick
 
Try something like this.......on UserForm code sheet

For Each C In Array("cboAreaP", "cboAreaV", "cboAreaD", "cboSingle",
"cboDouble", "cboSingle", "cboDouble","cboDebossed")
With Me.Controls(C)
.AddItem "25%"
.AddItem "50%"
.AddItem "75%"
.AddItem "100%"
End With
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

Back
Top