Puertorekinsam2
New Member
- Joined
- May 16, 2018
- Messages
- 2
I have six collections of auto generated user form controls
And I know I can add a control with this type of code:
But what I would like to do use a variable to indicate which collection I am adding to:
I just can't find anything on line that tells me how to do this.
I know I could do this with just the naming of the controls:
but later on this will be less elegant than I had originally hoped.
Code:
Dim MainLabels As Collection
Dim Metric1 As Collection
Dim Metric2 As Collection
Dim Metric3 As Collection
Dim Metric4 As Collection
Dim Metric5 As Collection
And I know I can add a control with this type of code:
Code:
MainLabels.Add ctrl, ctrl.Name
But what I would like to do use a variable to indicate which collection I am adding to:
Code:
Collection.name(Metric & i ).Add ctrl, ctrl.Name
I know I could do this with just the naming of the controls:
Code:
Set ctrl = Me.Controls.Add("Forms.Label.1", "Metric_& i & "_barline" )
but later on this will be less elegant than I had originally hoped.