View Full Version : userform with many buttons


diddi
02-01-2006, 01:06 AM
i have a userform with 60 commandbuttons and need some code to loop
through them all, making the ones without captions set to
..visible=false
can't seem to get variables defined properly.

any assistance greatly apprecieted =)

Rod Gill
02-01-2006, 01:37 AM
Try:

Private Sub UserForm_Click()
Dim O As Object
For Each O In UserForm1.Controls
If O.Caption = "" Then
O.Visible = False
End If
Next
End Sub

--

Rod Gill
Project MVP
Visit www.msproject-systems.com for Project Companion Tools and more


"diddi" <diddi@tpg.com.au> wrote in message
news:1138756019.652228.213440@o13g2000cwo.googlegroups.com...
>i have a userform with 60 commandbuttons and need some code to loop
> through them all, making the ones without captions set to
> .visible=false
> can't seem to get variables defined properly.
>
> any assistance greatly apprecieted =)
>