Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If Worksheets(1).CheckBox1.Value = True Then
CheckBox2.Visible = False End If - Piku -- Message posted from http://www.ExcelForum.com |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to do a loop so that I don't have to write "checkbox2.visible = false" for 29 checkboxes. Thanks.
|
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
using a checkbox for a conditional function | Excel Worksheet Functions | |||
Understanding Checkbox function | Charts and Charting in Excel | |||
Loop through checkBox on worksheet | Excel Programming | |||
For loop for Checkbox | Excel Programming | |||
For loop for Checkbox | Excel Programming |