webs110733 wrote:i have a question regarding many command buttons in VB...
i am using the VB editor with Microsoft Excel and i have a form that currently has 60 command buttons on it.... how would i be able to edit the code for all of them at once or may i make it so that i can put them into groups that allow me to edit the properties of many all at once?.... anything that will consolidate this work would be amazing advice....
I know this is an old topic but no one has given a solution.
If you have 60 Command buttons on a Form then you are better of using a Control Array. Then you will only need one lot of code in the Command1_Click(Index As Integer) event.
Now you just put 1 button an a Form or use one of the existing ones. Select the button and press the Copy button of Ctrl+C. Select a blank area on the Form and press the Paste button or Ctrl+V. You will be asked if you want to create a Control Array just click Yes.
Now you buttons will use the buttonname(Index). The Index will specify which buton in the array has been pressed. You just change the code in the section to use the Index number.
webs110733 wrote:
oh and would the solution work with checkboxes too? because i have about 660+ of them on another form....
Now your saying that you have 660+ checkboxes on another Form. That isn't possible because there is a limit to the number of controls of the same type you can have on a Form and this is 256 unless you use the Control Array as stated above.
What a confusing app it it with 660+ checkboxes.
