Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform Controls
I have a userform with 26 Labels, 13 TextBoxes and 2 CommandButtons. What I
want to know is if there is a loop code to loop through each control regaurdless of it's type and set Enable to False according to the Controls name? I have the Labels and TextBoxes named Cntrl1 thru Cntrl39. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform Controls
I'm not sure of exactly which controls you want to disable, so you
will have to adjust the logical test in the If statement, but this should give you the idea (paste this code within the click event of a button or trigger it as you want): Private Sub CommandButton1_Click() Dim c As Control For Each c In Me.Controls If c.Name = "Cntrl1" Then c.Enabled = False End If Next End Sub Good luck, Randy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
userform controls | Excel Programming | |||
Userform Controls | Excel Programming | |||
Help please with UserForm controls | Excel Programming | |||
Add controls to UserForm | Excel Programming | |||
What order does VBA look at userform controls? | Excel Programming |