Cell Edit = Checkbox Unclick

bnichols

New Member
Joined
Dec 28, 2022
Messages
14
Office Version
  1. 365
Platform
  1. MacOS
Hi, im trying to get this code to work so that when any cell in a range is edited, the checkbox with that particular name will uncheck. I've been unable to get it to work so far and was wondering if anyone saw anything I should adjust.

VBA Code:
Private Sub Worksheet_Change_Ctuit(ByVal Target As Range)
Application.EnableEvents = False

Dim ws As Worksheet: Set ws = ThisWorkbook.ActiveSheet
'--> Modify rng to suit
Dim rng As Range: Set rng = ws.Range("A1:A2")
'--> Modify the string to your Check Box number or exact name
Dim cbox As String: cbox1 = "Ctuit"

If Not Application.Intersect(rng, Range(Target.Address)) _
           Is Nothing Then
    ws.CheckBoxes(cbox1).Value = -4146
End If
Application.EnableEvents = True
End Sub
 
Would you not enable events to false before you make a change?
Would the check box value either be True or False, or 1 or 0
 
Upvote 0
Would you not enable events to false before you make a change?
Would the check box value either be True or False, or 1 or 0
Im still learning so im not sure on the events, I know that I was having trouble getting the worksheet change to run until I did it like that. For the True, and false, I operated under the same assumption and for several days couldn't figure out why my subs weren't working until I stumbled upon a thread that mentioned 1 true and -4146 false and everything worked like a charm after that. Not sure if its mac specific or if I messed something up somewhere.
 
Upvote 0

Forum statistics

Threads
1,226,771
Messages
6,192,918
Members
453,766
Latest member
Gskier

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