Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Need function for checkbox in loop

I have a group of check boxes and I want to do a loop if check box 1 is not checked. I want the loop to go through the other 29 check boxes and make them invisible. Any help would be great. Thanks. Mat


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need function for checkbox in loop

If Worksheets(1).CheckBox1.Value = True Then
CheckBox2.Visible = False
End If

- Piku

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Need function for checkbox in loop

I want to do a loop so that I don't have to write "checkbox2.visible = false" for 29 checkboxes. Thanks.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Need function for checkbox in loop

Hi Matt
Try this provided you do not use a multipage control and with checkboxes
inside that you dont want to go through
For Each ctr in UserForm1.Controls
if TypeOf ctr is MSForms.Checkbox then
'do your stuff
end if
Next ctr

HTH
Regards
Pascal


"Matt" a écrit dans le message de
...
I have a group of check boxes and I want to do a loop if check box 1 is

not checked. I want the loop to go through the other 29 check boxes and
make them invisible. Any help would be great. Thanks. Matt




  #5   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Need function for checkbox in loop

I did a similar thing with textboxes and captions by
defining a textboxes collection and adding my textboxes to
it, then looping through the collection, but I suspect
there's a better way than this

dim checkboxes as new collection
checkboxes.add checkbox1
checkboxes.add checkbox2
checkboxes.add checkbox3
checkboxes.add checkbox4
checkboxes.add checkbox5

'then loop
for each checkbox in checkboxes
checkbox.value=false
next



-----Original Message-----
I have a group of check boxes and I want to do a loop if

check box 1 is not checked. I want the loop to go through
the other 29 check boxes and make them invisible. Any help
would be great. Thanks. Matt


.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Need function for checkbox in loop

Matt, Here's how I would do it if those checkboxes were all on a User Form:

Sub Checkboxes( )
Dim ctl as Control
If CheckBox1.Value = False then
For each ctl in UserForm1
If TypeName(ctl) = "CheckBox" then
ctl.Visible = False
End If
Next
CheckBox1.Visible = True
End If
End Sub

-- Dennis Eisen

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Need function for checkbox in loop

That would work, except that I don't want all of the checkboxes on the worksheet to be invisible, just a selection of them. Any ideas? Thanks.
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Need function for checkbox in loop

maybe name your checkboxes nicely:

checkbox01 through checkbox29

and then pick out the ones you want hidden:

Option Explicit
Private Sub CommandButton1_Click()
Dim iCtr As Long
For iCtr = 13 To 26
Me.Controls("Checkbox" & Format(iCtr, "00")).Visible = False
Next iCtr
End Sub

Matt wrote:

That would work, except that I don't want all of the checkboxes on the worksheet to be invisible, just a selection of them. Any ideas? Thanks.


--

Dave Peterson

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
using a checkbox for a conditional function Brac Excel Worksheet Functions 4 December 8th 05 06:12 PM
Understanding Checkbox function Lori Burton Charts and Charting in Excel 1 July 25th 05 01:26 PM
Loop through checkBox on worksheet bman Excel Programming 3 November 26th 03 03:22 PM
For loop for Checkbox Tom Ogilvy Excel Programming 0 August 27th 03 01:03 AM
For loop for Checkbox Jake Marx Excel Programming 0 August 27th 03 12:23 AM


All times are GMT +1. The time now is 11:59 AM.

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

About Us

"It's about Microsoft Excel"