ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   userform labels (https://www.excelbanter.com/excel-programming/371975-userform-labels.html)

RobcPettit[_2_]

userform labels
 
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


ste

userform labels
 
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

RobcPettit wrote:
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



RobcPettit[_2_]

userform labels
 

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



All times are GMT +1. The time now is 05:37 PM.

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