View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
chad chad is offline
external usenet poster
 
Posts: 273
Default referencing a checkbox

I believe that the checkbox is from the forms toolbar (Is Office 2007 I go
under the Developer tab and then select 'Insert Control" and choose the
textbox under the form controls).

I have the code running under a module. The sub routine is called when the
checkbox is clicked, however, regardless of whether it is checked or not,
CheckBox1 is always recognized as False.

Thanks again for al lo fyour help.
Chad

"Dave Peterson" wrote:

Is this a checkbox from the Control toolbox toolbar or is this a checkbox from
the Forms toolbar?

If it's from the control toolbox toolbar, then is your code under the worksheet
that holds that checkbox?

If it's from the Forms toolbar, then the code belongs in a General module and
needs to be modified.

Did you allow macros to run when you opened the workbook?

Chad wrote:

I have been playing around with controls on excel 2007 and am getting
frustrated ofver something I am sure is very simple...I simply want to
perform an action when a checkbox = true. I have the following code:

Sub CheckBox1_Click()
If CheckBox1 = True Then
ThisWorkbook.Sheets("Sheet1").Cells(1, 1) = "A"
End If

End Sub

For some reason this code does not recognize when the checkbox is true or
not. can someone point me in the right direction?

Thanks!

Chad


--

Dave Peterson