ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Controls Array (https://www.excelbanter.com/excel-programming/401045-controls-array.html)

RyanH

Controls Array
 
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

Rick Rothstein \(MVP - VB\)

Controls Array
 
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


Nigel[_2_]

Controls Array
 
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

--

Regards,
Nigel




"RyanH" wrote in message
...
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




All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com