Control Array

R

Roger

I have to re format several Labels on a Userform - I only know how to format
them 1 at a time - could someone show me example code for formatting several
Labels at the same time in an array. Thankyou in anticipation
 
M

Mike H

Roger,

This works from a command button on a userform and the code loops through
all the controls and if they are labels you can format them.

Private Sub CommandButton1_Click()
Dim cCont As Control
For Each cCont In UserForm1.Controls
If TypeName(cCont) = "Label" Then
With cCont
'Your formatting code goes here
End With
End If
Next cCont
End Sub

Mike
 

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