![]() |
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 |
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 |
All times are GMT +1. The time now is 09:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com