Userform clear labels function

asyamonique

Well-known Member
Joined
Jan 29, 2008
Messages
1,113
How can I clear all the labels with a code on userform UserForm_Initialize() instead of wring below codes one by one?
Code:
Me.Label1.Caption = ("")
Thanks
 

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,593
Office Version
  1. 2007
Platform
  1. Windows
Use:

Code:
Private Sub UserForm_Initialize()
    Dim ctlr As MSForms.Control
     
    For Each ctlr In Me.Controls
        If TypeOf ctlr Is MSForms.Label Then
            ctlr.Caption = ""
        End If
    Next
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,109,446
Messages
5,528,802
Members
409,836
Latest member
karnasrinivas
Top