View Full Version : Form Control - Checkbox - Background changes colour when clicked
longyp
06-07-2011, 03:00 AM
How do i prevent the background colour of a checkbox changing when I click on it.
I have tried various settings but one problem I have is the sheet background colour is not available in the palette of the checkbox
Kenneth Hobs
06-07-2011, 05:24 AM
I don't know what you mean. You can enter the hex code or decimal number for the backcolor property at design time.
Private Sub CheckBox1_Click()
CheckBox1.BackColor = CheckBox1.TopLeftCell.Interior.Color
End Sub
If you want to do it at design time and don't know the numerical number then in the Immediate window:
?Sheet1.CheckBox1.TopLeftCell.Interior.Color
mikerickson
06-07-2011, 06:56 AM
For a checkbox from the Forms menu, you could use code like this
With ActiveSheet.Shapes("Check Box 1")
.Fill.ForeColor.SchemeColor = IIf(.ControlFormat.Value = xlOn, 13, 4): Rem toggles colors
.Fill.Visible = msoTrue
'.Fill.Visible = IIf(.ControlFormat.Value = xlOn, msoTrue, msoFalse): Rem unComment to toggle tranparent
End With
longyp
06-07-2011, 07:17 AM
Ken - thanks - again!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.