ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check Box Format! (https://www.excelbanter.com/excel-programming/296935-check-box-format.html)

Kim-Anh Tran

Check Box Format!
 
I have a check box. I would like to have this happens:
1. When the box is checked, it will appear "Y" in cell B4.
2. When it is unchecked, it will appear "N" in cell B4.
How do I make this happens?

Thanks in advance for your help!
Kim-An

--
Message posted from http://www.ExcelForum.com


Bob Kilmer[_2_]

Check Box Format!
 
Add this code (assumes name of checkbox is CheckBox1):

Private Sub CheckBox1_Click()
If CheckBox1.Value Then
Range("B4").Value = "Y"
Else
Range("B4").Value = "N"
End If
End Sub

"Kim-Anh Tran " wrote in
message ...
I have a check box. I would like to have this happens:
1. When the box is checked, it will appear "Y" in cell B4.
2. When it is unchecked, it will appear "N" in cell B4.
How do I make this happens?

Thanks in advance for your help!
Kim-Anh


---
Message posted from http://www.ExcelForum.com/




Kim-Anh Tran[_2_]

Check Box Format!
 
I forgot that cell "B4" is in another sheet!
How do I indicate the location of the cell B4?
Thanks again!
Kim-An

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Check Box Format!
 
Private Sub CheckBox1_Click()
With Worksheets("Sheet5")
If CheckBox1.Value Then
.Range("B4").Value = "Y"
Else
.Range("B4").Value = "N"
End If
End With
End Sub

--
Regards,
Tom Ogilvy


"Kim-Anh Tran " wrote in
message ...
I forgot that cell "B4" is in another sheet!
How do I indicate the location of the cell B4?
Thanks again!
Kim-Anh


---
Message posted from http://www.ExcelForum.com/




Kim-Anh Tran[_3_]

Check Box Format!
 
Check box40 is in sheet 1 and Cell "B4" is in sheet 2.
I appreciate anyone help to fix this problem! I have the error message
"Can't execute code in break mode"

Private Sub CheckBox40_Click()
With Worksheets("sheet 2")
If CheckBox40.Value Then
Range("B4").Value = "Y"
Else
Range("B4").Value = "N"
End If
End With
End Su

--
Message posted from http://www.ExcelForum.com


Bob Kilmer[_2_]

Check Box Format!
 
The message means code execution has been stopped (it is taking a "break".).
Either an error has paused execution for debug mode or you have paused
execution, yet the checkbox is trying to execute its code. Reset the code.
On the Run menu, click Reset <yourprojectname and try again.

"Kim-Anh Tran " wrote in
message ...
Check box40 is in sheet 1 and Cell "B4" is in sheet 2.
I appreciate anyone help to fix this problem! I have the error message:
"Can't execute code in break mode"

Private Sub CheckBox40_Click()
With Worksheets("sheet 2")
If CheckBox40.Value Then
Range("B4").Value = "Y"
Else
Range("B4").Value = "N"
End If
End With
End Sub


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 03:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com