Labels and Captions
Assuming you have exactly 5 label controls and they all are named as LabelX,
Dim i As Integer
For i = 1 To 5
Me.Controls("Label" & i).Caption = "My Caption"
Next i
If you wanted to just go through all label controls in the form, then
something like this might give you an idea
Dim c as control
For each c in Me.Controls
If TypeOf c is MSForms.Label then
c.Caption = "My Caption"
End If
Next c
" wrote:
Hey all,
I realize this should be easy, but I'm not finding the solution.
I have labels that are named Label1, Label2, Label3, ...
I want a loop to set the label's caption such as
For i = 1 to 5
Label(i).caption = "My Caption"
Next i
Thanks
|