View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy Patrick Molloy is offline
external usenet poster
 
Posts: 1,049
Default Form Control vs. Active X Controls

the control needs to be linked to a cell, so when clicked, the target cell
will be TRUE or FALSE
put your code into a standard module as assign your control's Assign Macro
property to it

eg
PUBLIC Sub CheckBox1_Click()
If worksheets("sheet1").Range("A1").Value Then
Hide_Loan_Details
Else
Show_Loan_Details
End If
End Sub

"Jim" wrote in message
...
I'm using Excel 2007 and want to put a check box above a range of cells
that
I want to assign two macros, one for checked, one for unchecked. I
struggled
for hours to get it working until I discovered I was using a Form Control
Check Box, not an Active X Control Check Box.

Using an Active X check box (Developer ribbon, controls, insert active x
check box) and the following code I can made it work:

Private Sub CheckBox1_Click()
If CheckBox1.Value = False Then
Hide_Loan_Details
Else
Show_Loan_Details
End If
End Sub

However I do prefer the Form Control Check box as it looks better, can be
filled with colours, etc. I've tried the following code and cannot make
it
work:

Private Sub LoanDetailCheckbox_Change()
If LoanDetailCheckbox.Value = xlOn Then
Show_Loan_Details
Else
Hide_Loan_Details
End If
End Sub

Is it possible to use the Form Control Check box in my worksheet?