![]() |
Userform help
Hi - I'm a pathological newbie in VB, and was wondering if anybody
could help me with a userform I am trying to create. As far as designing the form all is well. I have created a button on the sheet which makes the form popup, my problem is the next step. I have put 6 checkboxes that are assiociated with thier macro (quite simple, each one copies from a sheet with global info and pastes it onto a sheet and then deletes some rows according to a value in a column) and added an optionbox at the end which should run all of the checkboxes. At the end of the form is the ok button. My question is: how do I get the option box to select all of the checkboxes, and then have the ok button process the selected checkboxes? The ideal solution would be for the form to open with the "All" option selected, and for it to deselect if one or more of the checkboxes are selected. Thank you very much for any help you'll be able to give. Lorenzo |
Userform help
Private Sub CommandButton2_Click()
Dim ctl As Control For Each ctl In UserForm1.Controls If TypeOf ctl Is MSForms.CheckBox Then If ctl.Value = False Then ctl.Value = True Else ctl.Value = False End If End If Next End Sub This will toggle true/false for all checkboxes on the userform you can also use optionbutton to run this code only you can't toggle true/false then In the properties of your textboxes you can tell if they must be select if the userform open See Value in the properties list(select a checkbox in the VBA and press F4) -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Lorenzo" wrote in message om... Hi - I'm a pathological newbie in VB, and was wondering if anybody could help me with a userform I am trying to create. As far as designing the form all is well. I have created a button on the sheet which makes the form popup, my problem is the next step. I have put 6 checkboxes that are assiociated with thier macro (quite simple, each one copies from a sheet with global info and pastes it onto a sheet and then deletes some rows according to a value in a column) and added an optionbox at the end which should run all of the checkboxes. At the end of the form is the ok button. My question is: how do I get the option box to select all of the checkboxes, and then have the ok button process the selected checkboxes? The ideal solution would be for the form to open with the "All" option selected, and for it to deselect if one or more of the checkboxes are selected. Thank you very much for any help you'll be able to give. Lorenzo |
All times are GMT +1. The time now is 06:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com