Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
userform controls natanz[_2_] Excel Programming 3 November 2nd 05 02:38 PM
Userform Controls Nigel Excel Programming 5 December 30th 04 01:49 PM
Help please with UserForm controls sa3214 Excel Programming 4 July 2nd 04 03:00 AM
Add controls to UserForm Vyyk Drago Excel Programming 3 August 26th 03 01:22 PM
What order does VBA look at userform controls? Brad Patterson Excel Programming 3 July 17th 03 03:46 AM


All times are GMT +1. The time now is 06:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"