How to link a check box from form to a cell?
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 --- Message posted from http://www.ExcelForum.com/ |
How to link a check box from form to a cell?
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 -- Olly "Kim-Anh Tran " wrote in message ... 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 --- Message posted from http://www.ExcelForum.com/ |
How to link a check box from form to a cell?
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 -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 04:10 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com