Userform and checkbox....

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I am doind a Userform with 20 checkbox on it. So to do their properties I would like to use a for next. I have try to do it with a string like str = checkbox & "k" but it doesn't work. And I don't know how to do it with an object. Do you know a way to do it ?
Thanks for help
Benjamin
 
Hi Benjamin,
I am doind a Userform with 20 checkbox on it. So to do their properties I would like to use a for next. I have try to do it with a string like str = checkbox & "k" but it doesn't work. And I don't know how to do it with an object. Do you know a way to do it ?

You need to create their names as a string, then use the Controls() property to get the object:

Me.Controls("CheckBox " & k)

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.co.uk
 
Euh....
I am sorry but I am not sure of how do I create their name as a string
Do I have to use checkbox.name to rename them
Thanks for help Stephe
Benjamin
 
for i = 1 to 10
controls("CheckBox" & i).Value = False
Next

as an example.

another approach

for each ctrl in Userform1.Controls
if typeof ctrl is MSForms.CheckBox then
ctrl.Value = false
end if
Next
 
Back
Top