userform labels

  • Thread starter Thread starter RobcPettit
  • Start date Start date
R

RobcPettit

Hi, Ive got 20 labels on a userforn. Is there a better way to clear all
the labels, other than unloading and reloading the form. At the momment
i do, userform1.label1 = "", for all 20. I dont want to unload and
reload the form because label 21 keeps a count of procceses run while
form is in use.
Regards Robert
 
Try this in your UserForm

Private Sub xxx()
Dim Y As Control
Dim Cnt As Integer
Dim X As Integer
For X = 0 To Me.Controls.count - 1
Set Y = Me.Controls(X)
If TypeName(Y) = "Label" Then
Y.caption = ""
End If
Next
End sub

Regards,
Ste
 
Thankyou for your reply. That is perfect. thanks for taking the time
Regards Robert
 

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