Reputation: 21
So I just discovered the developer tab on excel and am having trouble trying to work with checkboxes.
I have a sheet with locations that can be checked twice
To keep track of some things, I have the usual linked cell next to the checkbox to say TRUE or FALSE to count them, as well as some cosmetic conditional formatting.
Now, what I want to do is: whenever you check the checkbox on the right, the checkbox on the left should be checked as well, but not the opposite.
I've been reading and reading but can't find a solution to this specifically. What I found that was most similar was this, but it didn't work with me (trying to change FALSE to TRUE) link to stackoverflow
Thank you in advance to anyone who has any idea how to do this, or has a link to an already answered question i could have missed!
PS: I know absolutely nothing about VBA, it's the first time I've used it. Also this is just a project on the side for a checklist, nothing serious but I figured I could make it pretty. I do know a bit of C# but I doubt it's helping.
Upvotes: 0
Views: 1197
Reputation: 2699
Assuming you have checkbox1
on the left, and checkbox2
on the right, and you want checkbox1
to be selected when checkbox2
is selected on:
Enable design mode first and right click on the checkbox2
and go to view code
Assign this code, then disable design mode
and it shall work:
Private Sub CheckBox2_Click()
If CheckBox2.Value = True Then
CheckBox1.Value = True
End If
End Sub
Upvotes: 1