How do I change the forecolor of a CheckBox when True
|
How do I change the forecolor of a CheckBox when True
Try code like the following:
Private Sub CheckBox1_Click() With Me.CheckBox1 If .Value < 0 Then ' checked .ForeColor = RGB(255, 0, 0) ' Red Else ' unchecked .ForeColor = RGB(0, 0, 255) ' Blue End If End With End Sub Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Fri, 10 Apr 2009 13:24:03 -0700, PJ Murph wrote: |
How do I change the forecolor of a CheckBox when True
How do I adapt your code into this?
'Public WithEvents CBXGroup As MSForms.CheckBox Private Sub CBXGroup_Change()' WhichOne = Mid(CBXGroup.Name, Len("cbxFee") + 1) With CBXGroup.Parent.OLEObjects("cbxFee" & WhichOne) .PrintObject = CBXGroup.Value End With "Chip Pearson" wrote: Try code like the following: Private Sub CheckBox1_Click() With Me.CheckBox1 If .Value < 0 Then ' checked .ForeColor = RGB(255, 0, 0) ' Red Else ' unchecked .ForeColor = RGB(0, 0, 255) ' Blue End If End With End Sub Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Fri, 10 Apr 2009 13:24:03 -0700, PJ Murph wrote: |
How do I change the forecolor of a CheckBox when True
With cbxgroup.parent.oleobjects("cbxfee" & whichone)
.printobject = cbxgroup.value with .object If .Value = True Then .ForeColor = RGB(255, 0, 0) ' Red Else .ForeColor = RGB(0, 0, 255) End If end with End With (Untested, uncompiled. Watch for typos.) PJ Murph wrote: How do I adapt your code into this? 'Public WithEvents CBXGroup As MSForms.CheckBox Private Sub CBXGroup_Change()' WhichOne = Mid(CBXGroup.Name, Len("cbxFee") + 1) With CBXGroup.Parent.OLEObjects("cbxFee" & WhichOne) .PrintObject = CBXGroup.Value End With "Chip Pearson" wrote: Try code like the following: Private Sub CheckBox1_Click() With Me.CheckBox1 If .Value < 0 Then ' checked .ForeColor = RGB(255, 0, 0) ' Red Else ' unchecked .ForeColor = RGB(0, 0, 255) ' Blue End If End With End Sub Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Fri, 10 Apr 2009 13:24:03 -0700, PJ Murph wrote: -- Dave Peterson |
All times are GMT +1. The time now is 07:49 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com