ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   loop through controls (https://www.excelbanter.com/excel-programming/306980-re-loop-through-controls.html)

libby

loop through controls
 
Hi Julie

try this

Private Sub cmdChange_Click()
Dim ctrl As Control
For Each ctrl In Me.Controls
Select Case ctrl.Enabled
Case True
ctrl.Enabled = False
ctrl.Locked = True
Case False
ctrl.Enabled = True
ctrl.Locked = False
End Select
Next
With Me.cmdChange 'stops the button from being affected
.Enabled = True
.Locked = False
End With
End Sub



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

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