That's because you're using check box objects from the Forms control
bar, not the Controls command bar. Put the following code in a module
and change the names of the check boxes accordingly. Assign the macro
to the check box.
Sub ChkClick()
Dim Chk1 As Excel.CheckBox
Dim Chk2 As Excel.CheckBox
Set Chk1 = Worksheets("Sheet1").CheckBoxes("Check Box 1")
Set Chk2 = Worksheets("Sheet1").CheckBoxes("Check Box 2")
If Chk1.Value = 1 Then
Chk2.Visible = True
Else
Chk2.Visible = False
End If
End Sub
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
On Tue, 17 Feb 2009 08:46:00 -0800, Adam H
<(E-Mail Removed)> wrote:
>hiya,
>
>thanks a lot for that but it doent seem to work with the version of excel i
>am using, i am using microsoft office excel 2002. do i need to update the
>software before being able to do this?? when i right click on the check box,
>the only options are cut, copy, paste, edit text, grouping, order, assign
>macro, and format control.
>
>Hope this makes it clearer.
>
>Thanks again
>
>"egun" wrote:
>
>> I added two checkboxes to a worksheet, with default names, in design view.
>> Right click on CheckBox2 and select Properties. In the Properties window,
>> select False for the Visible property.
>>
>> Right click on CheckBox1 and select View Code. In the Click event that is
>> automatically created, use the following code. It will change the visibility
>> of CheckBox2 according to the value of CheckBox1.
>>
>> You could also use the Enabled property for CheckBox2, if you wanted to keep
>> it visible but didn't want to allow the user to change its value unless
>> CheckBox1 is True.
>>
>> Private Sub CheckBox1_Click()
>> If Me.CheckBox1.Value Then
>> Me.CheckBox2.Visible = True
>> Else
>> Me.CheckBox2.Visible = False
>> End If
>> End Sub
>>
>> HTH,
>>
>> Eric
>>