View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default Highlight Check box

Private Sub CheckBox1_Click()
CheckBox1.Font.Bold = CheckBox1.Value
End Sub

Private Sub CheckBox1_GotFocus()
CheckBox1.BackColor = RGB(255, 50, 0)
CheckBox1.ForeColor = RGB(0, 0, 150)
CheckBox1.Font.Bold = CheckBox1.Value
End Sub

Private Sub CheckBox1_LostFocus()
CheckBox1.BackColor = RGB(255, 255, 255)
CheckBox1.ForeColor = RGB(0, 0, 0)
CheckBox1.Font.Bold = CheckBox1.Value
End Sub

Private Sub CheckBox1_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
CheckBox1.Activate
End Sub

HTH. Best wishes Harald

"Hank Hendrix" skrev i melding
...
Harald,
Thanks, that works great - except I would like the text to be bold = true

if
checked and bold = false if it is unchecked.
With this code it stays bold even if I later uncheck it.
As you might can tell - I'm new to code writing.

Is there a way to write code to include check boxes in the workbook with

the
text = "Action". My goal is to have the "Action" check boxes stand out

from
all other check boxes. I have a 12 page workbook with several hundred
checks boxes.
Thanks again
Hank

"Harald Staff" wrote in message
...
Hi Hank

There are some useful events.Without using classes you'll have to code

each
one separately:

Private Sub CheckBox1_GotFocus()
CheckBox1.BackColor = RGB(255, 50, 0)
CheckBox1.ForeColor = RGB(0, 0, 150)
CheckBox1.Font.Bold = True
End Sub

Private Sub CheckBox1_LostFocus()
CheckBox1.BackColor = RGB(255, 255, 255)
CheckBox1.ForeColor = RGB(0, 0, 0)
CheckBox1.Font.Bold = False
End Sub

Private Sub CheckBox1_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
CheckBox1.Activate
End Sub

Problem with controls directly onto worksheets is that you can't Tab

between
them without coding that behavior.

HTH. Best wishes Harald

"Hank Hendrix" skrev i melding
...
Is there a way to have a check box stand out by changing color, bold

type,
or another way when it is checked.
I have many check boxes on a worksheet. I would like some of them to

"stand
out" if selected.
Thanks
Hank