Can a checkbox be colored when checked?

daniels012

Well-known Member
Joined
Jan 13, 2005
Messages
5,219
I have a checkbox created from forms toolbar.
Is there a way to color this box when checked?

Thank You,
Michael
 
Michael

Are you 100% sure these are controls from the Forms toolbar?
 
Upvote 0

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Yes I am!!
If they were from the Control Toolbox Toolbar, I would not be able to right click and add a macro or format the contol with out first going to the Toolbar.

Michael
 
Upvote 0
Erik,
All of the sudden your code started to work... Why I have no idea?

Michael
perhaps you tried to run "manually"
it can only run when called from a checkboxclick

now that this is sorted, can you explain a bit more about all those checkboxes:there could be a way which is much simpler, would be easy to expand and wouldn't need checkboxes at all
try out this basic code
adapted to your specific situation, it could replace all those boxes
adding some conditional format would do the highlight-trick ;)
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'will put or erase a checkmark in column B
Dim RH As Single

If Target.Count > 1 Then Exit Sub
If Target.Column <> 2 Then Exit Sub

    With Target
    RH = .RowHeight
    .Font.Name = "Marlett"
    .Font.Size = 10
    .RowHeight = RH
    .HorizontalAlignment = xlCenter
    .VerticalAlignment = xlCenter
    .Value = IIf(.Value = "a", "", "a")
    End With

End Sub
kind regards,
Erik
 
Upvote 0
I think the reason for sometimes working anf sometimes not was the fact that there were "Group Boxes" that were objects that gave an error when I tried to click on one of the checkboxes. So I eliminated them and it works fine now.

I think I will keep what I got. There are so many that have text with it, I would have to re-write all the of the text and place it into a cell before erasing all the boxes. They are scattered throughout the form as well.

Thank you for all your help and effort though!!
Michael
 
Upvote 0

Forum statistics

Threads
1,215,691
Messages
6,126,219
Members
449,303
Latest member
grantrob

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