Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Highlight Check box

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Highlight Check box

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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Highlight Check box


there's 2 types of checkboxes that can be inserted in a worksheet.

The first is inserted from Control Toolbox Tool (embedded CB)
The second one is inserted from Forms Toolbar (native CB)


The embedded (msforms.checkbox.1) control has many more properties and
settings than the native checkbox.

And coding it is easy: (in the sheet's code module..)

Private Sub CheckBox1_Change()
With Me.CheckBox1
.BackColor = IIf(.Value, vbWhite, vbRed)
End With
End Sub


BUT i'm not a fan of using (a lot of) embedded controls on a worksheet.
Clean your temp directory.
Open a file with 50 or so checkboxes
Now check your temp directory and you'll see why.


So let's see what we can do with a NATIVE checkbox...
You could assign a macro to it... when clicked runs and changes color.

use the application.caller to get the name..
and you'll need one macro only..

(again put this in the SHEET's code module)

Sub CheckBox_ChangeNative()
With Me.Shapes(Application.Caller).Fill.ForeColor
.SchemeColor = IIf(.SchemeColor = 10, 9, 10)
End With
End Sub



I'd go for the second approach..




keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Hank Hendrix" wrote:

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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Highlight Check box

I didn't do the
"use the application.caller to get the name.." bit, and
With the NATIVE checkboxes I Received a type-missmatch error for the
"With Me.Shapes(Application.Caller).Fill.ForeColor"
line. What am I doing wrong?


"keepITcool" wrote in message
...

there's 2 types of checkboxes that can be inserted in a worksheet.

The first is inserted from Control Toolbox Tool (embedded CB)
The second one is inserted from Forms Toolbar (native CB)


The embedded (msforms.checkbox.1) control has many more properties and
settings than the native checkbox.

And coding it is easy: (in the sheet's code module..)

Private Sub CheckBox1_Change()
With Me.CheckBox1
.BackColor = IIf(.Value, vbWhite, vbRed)
End With
End Sub


BUT i'm not a fan of using (a lot of) embedded controls on a worksheet.
Clean your temp directory.
Open a file with 50 or so checkboxes
Now check your temp directory and you'll see why.


So let's see what we can do with a NATIVE checkbox...
You could assign a macro to it... when clicked runs and changes color.

use the application.caller to get the name..
and you'll need one macro only..

(again put this in the SHEET's code module)

Sub CheckBox_ChangeNative()
With Me.Shapes(Application.Caller).Fill.ForeColor
.SchemeColor = IIf(.SchemeColor = 10, 9, 10)
End With
End Sub



I'd go for the second approach..




keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Hank Hendrix" wrote:

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






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.714 / Virus Database: 470 - Release Date: 02.07.2004






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Highlight Check box

the code is in the sheet's object module?
(else the me keyword will not apply)

is the code only called by a macro assigned to the checkbox?



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Martyn Wilson" wrote:

I didn't do the
"use the application.caller to get the name.." bit, and
With the NATIVE checkboxes I Received a type-missmatch error for the
"With Me.Shapes(Application.Caller).Fill.ForeColor"
line. What am I doing wrong?


"keepITcool" wrote in message
...

there's 2 types of checkboxes that can be inserted in a worksheet.

The first is inserted from Control Toolbox Tool (embedded CB)
The second one is inserted from Forms Toolbar (native CB)


The embedded (msforms.checkbox.1) control has many more properties

and
settings than the native checkbox.

And coding it is easy: (in the sheet's code module..)

Private Sub CheckBox1_Change()
With Me.CheckBox1
.BackColor = IIf(.Value, vbWhite, vbRed)
End With
End Sub


BUT i'm not a fan of using (a lot of) embedded controls on a

worksheet.
Clean your temp directory.
Open a file with 50 or so checkboxes
Now check your temp directory and you'll see why.


So let's see what we can do with a NATIVE checkbox...
You could assign a macro to it... when clicked runs and changes

color.

use the application.caller to get the name..
and you'll need one macro only..

(again put this in the SHEET's code module)

Sub CheckBox_ChangeNative()
With Me.Shapes(Application.Caller).Fill.ForeColor
.SchemeColor = IIf(.SchemeColor = 10, 9, 10)
End With
End Sub



I'd go for the second approach..




keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Hank Hendrix" wrote:

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






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.714 / Virus Database: 470 - Release Date: 02.07.2004










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Highlight Check box

The *.xls that didn't work can be reached from he
http://www.eserceker.com/isaretliler.xls
I'd appreciate if you can have a look at it.
Sincerely
M.W


"keepITcool" wrote in message
...
the code is in the sheet's object module?
(else the me keyword will not apply)

is the code only called by a macro assigned to the checkbox?



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Martyn Wilson" wrote:

I didn't do the
"use the application.caller to get the name.." bit, and
With the NATIVE checkboxes I Received a type-missmatch error for the
"With Me.Shapes(Application.Caller).Fill.ForeColor"
line. What am I doing wrong?


"keepITcool" wrote in message
...

there's 2 types of checkboxes that can be inserted in a worksheet.

The first is inserted from Control Toolbox Tool (embedded CB)
The second one is inserted from Forms Toolbar (native CB)


The embedded (msforms.checkbox.1) control has many more properties

and
settings than the native checkbox.

And coding it is easy: (in the sheet's code module..)

Private Sub CheckBox1_Change()
With Me.CheckBox1
.BackColor = IIf(.Value, vbWhite, vbRed)
End With
End Sub


BUT i'm not a fan of using (a lot of) embedded controls on a

worksheet.
Clean your temp directory.
Open a file with 50 or so checkboxes
Now check your temp directory and you'll see why.


So let's see what we can do with a NATIVE checkbox...
You could assign a macro to it... when clicked runs and changes

color.

use the application.caller to get the name..
and you'll need one macro only..

(again put this in the SHEET's code module)

Sub CheckBox_ChangeNative()
With Me.Shapes(Application.Caller).Fill.ForeColor
.SchemeColor = IIf(.SchemeColor = 10, 9, 10)
End With
End Sub



I'd go for the second approach..




keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Hank Hendrix" wrote:

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






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.714 / Virus Database: 470 - Release Date: 02.07.2004










---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.714 / Virus Database: 470 - Release Date: 02.07.2004


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Highlight Check box

Your cheating :) your boxes are transparent...
when the fill aint visible.. it's no use changing the color :)

Sub CheckBox_ChangeNative()
With Me.Shapes(Application.Caller)
If .ControlFormat.Value = 1 Then
.Fill.ForeColor.SchemeColor = 10
.Fill.Visible = True
Set x = Me.Shapes(Application.Caller)
Else
.Fill.Visible = False
End If
End With
End Sub


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Martyn Wilson" wrote:

http://www.eserceker.com/isaretliler.xls


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Highlight Check box

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






  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Highlight Check box

Thanks keepITcool,
Maybe I was rather sleepy while working on this...Sorry about that ;)

"keepITcool" wrote in message
...
Your cheating :) your boxes are transparent...
when the fill aint visible.. it's no use changing the color :)

Sub CheckBox_ChangeNative()
With Me.Shapes(Application.Caller)
If .ControlFormat.Value = 1 Then
.Fill.ForeColor.SchemeColor = 10
.Fill.Visible = True
Set x = Me.Shapes(Application.Caller)
Else
.Fill.Visible = False
End If
End With
End Sub


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Martyn Wilson" wrote:

http://www.eserceker.com/isaretliler.xls




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.714 / Virus Database: 470 - Release Date: 02.07.2004


  #10   Report Post  
Posted to microsoft.public.excel.programming
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








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
Can you highlight locked cells in excell, so you can check i Tony Excel Discussion (Misc queries) 7 July 26th 09 10:02 PM
Can I highlight misspelt words in cells when I use the spell check Black Project Excel Discussion (Misc queries) 4 May 15th 07 09:05 AM
Check and Highlight! [email protected] Excel Discussion (Misc queries) 1 April 24th 06 07:19 PM
check boxes that highlight row static69 Excel Discussion (Misc queries) 2 May 28th 05 12:07 PM
Highlight cells with ctrl-click but only un-highlight one cell hagan Excel Discussion (Misc queries) 5 May 27th 05 06:45 PM


All times are GMT +1. The time now is 09:38 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"