How to link a check box from form to a cell?

  • Thread starter Thread starter Kim-Anh Tran
  • Start date Start date
K

Kim-Anh Tran

Hello everyone,
I have a check box placed by cell B5. I would like to give value 1 to
cell B10 every time this box is check and 0 when unchecked. But I have
problem linking this to a cell. I know that I can link to a cell using
check box from control tool box. But I don't now how to write code
using VB.
Thanks in advance fro any help!
Regards,
Kim-Anh
 
In the module for the worksheet containing the CheckBox:

Private Sub CheckBox1_Click()
Select Case CheckBox1.Value
Case True: Range("B10").Value = 1
Case Else: Range("B10").Value = 0
End Select
End Sub
 
In design mode (depress Blue triangle) right click your checkbox > View Cod
Add this Code
Private Sub CheckBox1_Click() '<<<This is provide
If Me.CheckBox1 = True Then Range("B10") =
If Me.CheckBox1 = False Then Range("B10") =
End Sub '<<<This is provide
(depress Blue triangle

----- Kim-Anh Tran > wrote: ----

Hello everyone
I have a check box placed by cell B5. I would like to give value 1 t
cell B10 every time this box is check and 0 when unchecked. But I hav
problem linking this to a cell. I know that I can link to a cell usin
check box from control tool box. But I don't now how to write cod
using VB
Thanks in advance fro any help
Regards
Kim-An
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top