ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Disable a checkbox dependant upon cell data (https://www.excelbanter.com/excel-discussion-misc-queries/43448-disable-checkbox-dependant-upon-cell-data.html)

frendabrenda1

Disable a checkbox dependant upon cell data
 
I have a checkbox set up (NOT on a form) that I would like to disable when a
corresponding cell says "Not Applicable".

If a macro must be used for this....where does the code go?

Thank you for any info.

mas_detokyo


I think, you can do it by putting the code below to the sheet macro
which your checkbox resides.

Code:
--------------------

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo EXITSUB:
Me.CheckBox1.Enabled = IIf(Range("$A$1").Value = "NA", False, True)
EXITSUB:
End Sub

--------------------

Assumption:
1. CheckBox is named as "CheckBox1".
2. Corresponding cell is "$A$1".
3. Disable CheckBox when the cell "$A$1" get value "NA"
You can change the code accordingly as you want.

mas


--
mas_detokyo


------------------------------------------------------------------------
mas_detokyo's Profile: http://www.excelforum.com/member.php...o&userid=26712
View this thread: http://www.excelforum.com/showthread...hreadid=401120



All times are GMT +1. The time now is 09:01 AM.

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