Disable checkbox on cell value

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
That's still not clear!

To disable it when G51 is No then all you need is:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim ctlCheckBox     As CheckBox

    With Me
        Set ctlCheckBox = .CheckBoxes("CheckboxCW100")
        ctlCheckBox.Enabled = Not .Range("G51").Value = "No"
    End With
End Sub

I really don't get what you are trying to do with:
Code:
        If .Range("G51") = "No" Then
             ctlCheckBox.Value = 2
        Else
             ctlCheckBox.Value = 0
        End If

I mean, what purpose does it serve? You are forcing the value of the checkbox to be TRUE when G51 is No, and otherwise FALSE.
 
Upvote 0
Its puropse is just visual, so that when the checkbox is disabled, it clearly looks disabled by being grayed out rather than just unclickable.
 
Upvote 0
You asked what is the code's purpose. Its purpose is to gray out the checkbox when G51 is "No", otherwise return it to unchecked. The problem is I don't know how to stop it returning to unchecked when the user actually wants to check it.
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,400
Members
449,448
Latest member
Andrew Slatter

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top