Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default code to hide check boxes

I want a group of check boxes to only be visible if another check box is selected. When the other check box is not selected, I want the group to be invisible. Also, I need to know if I should put the code in the Worksheet code or the Workbook code. Thanks. Matt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default code to hide check boxes

Matt,

Try this code

Private Sub CheckBox1_Click()
With CheckBox1
CheckBox2.Visible = .Value
CheckBox3.Visible = .Value
CheckBox4.Visible = .Value
CheckBox5.Visible = .Value
End With
End Sub

put it in the worksheet code module. I assume you arev using control
checkboxes. not forms
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Matt" wrote in message
...
I want a group of check boxes to only be visible if another check box is

selected. When the other check box is not selected, I want the group to be
invisible. Also, I need to know if I should put the code in the Worksheet
code or the Workbook code. Thanks. Matt


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default code to hide check boxes

I am using form check boxes. Is this a problem?

----- Bob Phillips wrote: -----

Matt,

Try this code

Private Sub CheckBox1_Click()
With CheckBox1
CheckBox2.Visible = .Value
CheckBox3.Visible = .Value
CheckBox4.Visible = .Value
CheckBox5.Visible = .Value
End With
End Sub

put it in the worksheet code module. I assume you arev using control
checkboxes. not forms
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Matt" wrote in message
...
I want a group of check boxes to only be visible if another check box is

selected. When the other check box is not selected, I want the group to be
invisible. Also, I need to know if I should put the code in the Worksheet
code or the Workbook code. Thanks. Matt



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default code to hide check boxes

Matt,

Yes it is because AFAIK you can't hide the forms checkbox. SO if you want
this facility, best to switch tow controls checkboxes.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Matt" wrote in message
...
I am using form check boxes. Is this a problem?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default code to hide check boxes

I had a handfull of checkboxes on a worksheet and this hid all of them and then
unhid the "master" checkbox.

Option Explicit
Sub testme01()
Dim myKeyCBX As CheckBox
Set myKeyCBX = ActiveSheet.CheckBoxes(Application.Caller)
ActiveSheet.CheckBoxes.Visible = CBool(myKeyCBX.Value = xlOn)
myKeyCBX.Visible = True
End Sub

Put the macro in a general module. Assign the key checkbox this macro
(rightclick on it and Assign macro).

If you have them grouped, you could name them nicely (same 4 character prefix
for each grouped checkbox) and loop through them:

Option Explicit
Sub testme01a()
Dim myKeyCBX As CheckBox
Dim myCBX As CheckBox

Application.ScreenUpdating = False

Set myKeyCBX = ActiveSheet.CheckBoxes(Application.Caller)
For Each myCBX In ActiveSheet.CheckBoxes
If Left(LCase(myCBX.Name), 4) = LCase(Left(myKeyCBX.Name, 4)) Then
If myKeyCBX.Name = myCBX.Name Then
'do nothing
Else
myCBX.Visible = CBool(myKeyCBX.Value = xlOn)
End If
End If
Next myCBX

Application.ScreenUpdating = True

End Sub




Matt wrote:

I am using form check boxes. Is this a problem?

----- Bob Phillips wrote: -----

Matt,

Try this code

Private Sub CheckBox1_Click()
With CheckBox1
CheckBox2.Visible = .Value
CheckBox3.Visible = .Value
CheckBox4.Visible = .Value
CheckBox5.Visible = .Value
End With
End Sub

put it in the worksheet code module. I assume you arev using control
checkboxes. not forms
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Matt" wrote in message
...
I want a group of check boxes to only be visible if another check box is

selected. When the other check box is not selected, I want the group to be
invisible. Also, I need to know if I should put the code in the Worksheet
code or the Workbook code. Thanks. Matt




--

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
how to Hide/reappear check boxes MWL Excel Discussion (Misc queries) 0 February 13th 09 10:29 AM
how to Hide/reappear label & check boxes MWL Excel Discussion (Misc queries) 0 February 12th 09 04:56 PM
Hide & Show Rows based on Check Boxes loza Excel Discussion (Misc queries) 1 September 14th 08 01:49 AM
Check boxes to show/hide Tabs Sridhar Rao Excel Worksheet Functions 1 January 5th 05 03:28 PM
Want to hide check boxes Matt Excel Programming 1 January 8th 04 10:56 PM


All times are GMT +1. The time now is 01:47 PM.

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"