Set multiple cmd boxes to enabled = true

Hi Experts,
Fairly simple one, but one that is bugging me...

I have 100 cmd boxes cmd1, cmd2, cmd3..... cmd100 upon clicking the rest button i want all of the cmdbuttons to set enabled = true. i know i could go through each one putting cmdX.enabled = true but it seems a bit messy. is there a way to do it in some kind of loop? e.g.:
for x = 1 to 100
         cmd & x.enabled = true
next

Thanks guys
Regards Matt
Matty_mcaAsked:
Who is Participating?
 
Antagony1960Connect With a Mentor Commented:
This will enable every button on the form:

Dim objControls
    For Each objControls In Me.Controls
        If TypeName(objControls) = "CommandButton" Then objControls.Enabled = True
    Next

If you need to limit the enabling to specific buttons you could perhaps put a value in their Tag property and check that before enabling them.
0
 
Matty_mcaAuthor Commented:
Thanks Antagony1960.
Tag property also worked a treat
cheers
Matt
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.