Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default How do I change the forecolor of a CheckBox when True


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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:

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default 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:


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
change Excel Cell forecolor using VB6 Lennie Excel Discussion (Misc queries) 2 August 17th 08 12:27 AM
For...Loop to verify at least one checkbox = True RyanH Excel Programming 2 May 13th 08 03:43 PM
change forecolor with code Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 2 November 29th 07 05:24 PM
If one checkbox = true damorrison Excel Discussion (Misc queries) 1 August 26th 06 01:47 PM
checkbox true/false label [email protected] Excel Programming 6 October 4th 05 04:11 PM


All times are GMT +1. The time now is 07:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"