Go to adjacent cell

New2013

New Member
Joined
Oct 29, 2013
Messages
11
Hi all
I'm really new at this VBA programming and have searched the forums and can't find the answer to my question. I appreciate any help you all can give.

What I'm trying to do is when a checkbox (any checkbox in the workbook) is clicked then I want the cell two to the left of it to change colors to green.

Can anyone tell me how to do this? I don't really care if it's an ActiveX control or a regular checkbox.

Thank you.
 
I was thinking that there might be a way to create some code that would (maybe a for/each loop) with a user form that would create the control with incremented numbering, but that's a horse of a different color.
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
I also tried
Code:
If Obj.Name Like "CheckBox*_*" Then
and that didn't work at all. I copy/pasted a range of the cbClearedOrNot_x controls to another worksheet and it named them all CheckBox1, CheckBox2, etc. So there's no way I can see to copy the controls from one worksheet that contains the correct naming convention to a different worksheet without manually going to each control and renaming it. :confused:
 
Upvote 0
I also tried
Code:
If Obj.Name Like "CheckBox*_*" Then
and that didn't work at all. I copy/pasted a range of the cbClearedOrNot_x controls to another worksheet and it named them all CheckBox1, CheckBox2, etc. So there's no way I can see to copy the controls from one worksheet that contains the correct naming convention to a different worksheet without manually going to each control and renaming it. :confused:
The underline character is what stopped it from working because the default names (e.g., CheckBox1) does not have an underline character in it. Try this instead...

If Obj.Name Like "CheckBox*" Then

However, note that if you use the default names for all your CheckBoxes, then the only checkboxes you can have in your project are the ones that do the offset coloring. If you will have other CheckBoxes in the project that you do not want to have this feature you must rename them so that their first 8 characters are not "CheckBox".
 
Upvote 0

Forum statistics

Threads
1,215,348
Messages
6,124,425
Members
449,157
Latest member
mytux

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