Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UserForm bgkgmg Excel Worksheet Functions 1 February 26th 09 04:25 PM
UserForm FSt1 Excel Worksheet Functions 0 February 26th 09 02:00 AM
userform carwincarber New Users to Excel 0 October 23rd 05 06:59 PM
UserForm CR Excel Discussion (Misc queries) 1 August 10th 05 10:26 PM
Userform Help in VBC Marcia3641 Excel Discussion (Misc queries) 1 July 23rd 05 12:10 AM


All times are GMT +1. The time now is 04:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"