Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Clear All Checkboxes?

I'm developing a fairly complex Userform with 8 checkboxes. Is there a way to
control all boxes with one command. Say for example the end user selects 6 of
the 8 boxes, then clicks run and then excel does its thing. My question is,
is there anyway to clear all the checkboxes with one line, instead of
checkbox1.value = false, checkbox2.value = false, etc...? Or another example
would be if none of the checkboxes are selected then my msgbox would appear,
but be able to do this in one line. I just want to simplfy the code from 8
lines to 1 line. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default Clear All Checkboxes?

Add a Frame in the userform and move all the checkboxes in to that frame.
If userform name is UF1 and Fram name is Frm1 Then
You can do:

Dim chBx
For each chBx in Frm1.Controls
chBx.Value = False
Next

Sharad

"Brad" wrote in message
...
I'm developing a fairly complex Userform with 8 checkboxes. Is there a way
to
control all boxes with one command. Say for example the end user selects 6
of
the 8 boxes, then clicks run and then excel does its thing. My question
is,
is there anyway to clear all the checkboxes with one line, instead of
checkbox1.value = false, checkbox2.value = false, etc...? Or another
example
would be if none of the checkboxes are selected then my msgbox would
appear,
but be able to do this in one line. I just want to simplfy the code from
8
lines to 1 line. Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Clear All Checkboxes?

for each ctrl in userform1.controls
if typeof ctrl is MsForms.checkbox then
ctrl.Value = False
end if
Next

or

for i = 1 to 8
if userform1.Controls('checkbox" & i).Value = False
Next

there is no Checkboxes.Clear command.

--
Regards,
Tom Ogilvy


"Brad" wrote in message
...
I'm developing a fairly complex Userform with 8 checkboxes. Is there a way

to
control all boxes with one command. Say for example the end user selects 6

of
the 8 boxes, then clicks run and then excel does its thing. My question

is,
is there anyway to clear all the checkboxes with one line, instead of
checkbox1.value = false, checkbox2.value = false, etc...? Or another

example
would be if none of the checkboxes are selected then my msgbox would

appear,
but be able to do this in one line. I just want to simplfy the code from

8
lines to 1 line. Thanks.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Clear All Checkboxes?

Here is a snip-it from one of my macros to clear text boxes, maybe you
can alter it to work for you.

For Each txtcontrol In Controls
If Left(txtcontrol.Name, 2) = "tx" Then txtcontrol.Text = ""
Next



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Clear certain checkboxes Arlen Excel Discussion (Misc queries) 4 May 20th 10 11:42 PM
How to clear all checkboxes on a form? Arlen Excel Worksheet Functions 2 May 6th 10 04:20 PM
Macro to clear checkboxes Guy[_2_] Excel Worksheet Functions 5 January 2nd 09 08:39 PM
Clear Checkboxes fak119 Excel Discussion (Misc queries) 1 March 22nd 07 04:43 PM
How do I clear all Checkboxes on a worksheet on open wapfu Excel Programming 2 August 11th 04 09:15 PM


All times are GMT +1. The time now is 08:21 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"