[h=2][SIZE=12px]Guys, please your help to modify the code, so I will be able to know the number of checked checkbox.[/SIZE][/h]
[SIZE=12px]Thanks[/SIZE]
Which CheckBox checked?
- jonny
- Thread is marked as Resolved.
-
-
-
............................................
-
Sorry, I don't see any correlation to what I asked.
I have a code with a dynamically added controls so I'm looking to create a kind of event handler with a right syntax. -
You need to use a Class Module.
The code that adds the checkboxes to the user form also needs to add each check box to the class module. You also need a label on the user form to display the number of check boxes that have been checked.
Each time a check box gets changed (checked or unchecked) the procedure in the class module will pick up the change and modify the label on the user form.
-
OzMVP, thank you fo a detailed clarification. I understand it theoretically and have been trying to implement that last days however getting lost with the syntax.
-
I am tied up with something else right now but will have a go at it when I get a chance.
-
Your code creates a new UserForm every time it runs. Do you really need it to do that, or can it just create a new UserForm1 which would replace an existing UserForm1?
-
Just create a new UserForm1 which would replace an existing UserForm1
-
OK, that simplifies it a bit! Leave it with me and I will see what I can do.
-
Try the attached.
-
Just realised I forgot to update the Class Module code from where I was trying to make it dynamic for a newely created Userform with an unknown Name.
You can change the code in the clsChkBxs Class Module to this
-
The file I added earlier will create UserForm1, allow you to use it, then remove it.
If you want to retain the created Userform1 for later use then use the attached. The top button will create a new UserForm1 (after removing an existing UserForm1), and the lower button will show the existing UserForm1
Note: In order to use this file you will need to add a reference to the VB before clicking the button to create a new UserForm.
- Open VB Editor
- Click "Tools" in menu bar
- Select References
- If "Microsoft Visual Basic for Applications Extensibility 5.3" is not already checked, scroll down to it and check it, then click OK
-
Many thanks, will check this out..
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!