Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Is there a Macro to enable a check box based on the content of a c

I want to be able to have a check appear in the box if I have an amount 0.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Is there a Macro to enable a check box based on the content of a c

What changes the amount - someone editing the cell with the amount?


right click on the sheet tab and select view code.

Private Sub Worksheet_Change(ByVal Target As Range)
if Target.Address = "$B$9" then
If Target.Value 0 then
me.checkbox1.Value = True
else
me.checkbox1.Value = False
end if
End if
end sub

--
Regards,
Tom Ogilvy




"Nausett" wrote:

I want to be able to have a check appear in the box if I have an amount 0.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Is there a Macro to enable a check box based on the content of

How do I get Excel the Checkbox to recognize the new Macro?

"Tom Ogilvy" wrote:

What changes the amount - someone editing the cell with the amount?


right click on the sheet tab and select view code.

Private Sub Worksheet_Change(ByVal Target As Range)
if Target.Address = "$B$9" then
If Target.Value 0 then
me.checkbox1.Value = True
else
me.checkbox1.Value = False
end if
End if
end sub

--
Regards,
Tom Ogilvy




"Nausett" wrote:

I want to be able to have a check appear in the box if I have an amount 0.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Is there a Macro to enable a check box based on the content of

The checkbox is a passive victim. Given the assumptions I made, if you have
a checkbox named checkbox1 (from the control toolbox toolbar) and it is
located on the sheet with the code, and you have a cell B9, and with the code
in the sheet module as I described, you change the value of B9 to 3 (as an
example), checkbox1 should get checked.

--
Regards,
Tom Ogilvy


"Nausett" wrote:

How do I get Excel the Checkbox to recognize the new Macro?

"Tom Ogilvy" wrote:

What changes the amount - someone editing the cell with the amount?


right click on the sheet tab and select view code.

Private Sub Worksheet_Change(ByVal Target As Range)
if Target.Address = "$B$9" then
If Target.Value 0 then
me.checkbox1.Value = True
else
me.checkbox1.Value = False
end if
End if
end sub

--
Regards,
Tom Ogilvy




"Nausett" wrote:

I want to be able to have a check appear in the box if I have an amount 0.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Is there a Macro to enable a check box based on the content of

I'm getting a Compile Error: Method or Data Member Not Found. Am I doing
something wrong?
Thanks,

"Tom Ogilvy" wrote:

The checkbox is a passive victim. Given the assumptions I made, if you have
a checkbox named checkbox1 (from the control toolbox toolbar) and it is
located on the sheet with the code, and you have a cell B9, and with the code
in the sheet module as I described, you change the value of B9 to 3 (as an
example), checkbox1 should get checked.

--
Regards,
Tom Ogilvy


"Nausett" wrote:

How do I get Excel the Checkbox to recognize the new Macro?

"Tom Ogilvy" wrote:

What changes the amount - someone editing the cell with the amount?


right click on the sheet tab and select view code.

Private Sub Worksheet_Change(ByVal Target As Range)
if Target.Address = "$B$9" then
If Target.Value 0 then
me.checkbox1.Value = True
else
me.checkbox1.Value = False
end if
End if
end sub

--
Regards,
Tom Ogilvy




"Nausett" wrote:

I want to be able to have a check appear in the box if I have an amount 0.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Is there a Macro to enable a check box based on the content of

Highly likely that you are doing something wrong. I put a checkbox on my
worksheet and named it Checkbox1. I then pasted in the code from the email
into the sheet module for that worksheet.

I entered a 3 in B9, the checkbox was checked.

I entered a 0 in B9,. the checkbox was unchecked.

--
Regards,
Tom Ogilvy

"Nausett" wrote in message
...
I'm getting a Compile Error: Method or Data Member Not Found. Am I doing
something wrong?
Thanks,

"Tom Ogilvy" wrote:

The checkbox is a passive victim. Given the assumptions I made, if you

have
a checkbox named checkbox1 (from the control toolbox toolbar) and it is
located on the sheet with the code, and you have a cell B9, and with the

code
in the sheet module as I described, you change the value of B9 to 3 (as

an
example), checkbox1 should get checked.

--
Regards,
Tom Ogilvy


"Nausett" wrote:

How do I get Excel the Checkbox to recognize the new Macro?

"Tom Ogilvy" wrote:

What changes the amount - someone editing the cell with the amount?


right click on the sheet tab and select view code.

Private Sub Worksheet_Change(ByVal Target As Range)
if Target.Address = "$B$9" then
If Target.Value 0 then
me.checkbox1.Value = True
else
me.checkbox1.Value = False
end if
End if
end sub

--
Regards,
Tom Ogilvy




"Nausett" wrote:

I want to be able to have a check appear in the box if I have an

amount 0.


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
how to change a cell color based on its content using macro? Ranger888 New Users to Excel 6 December 15th 08 08:23 PM
Check cells content based on a table David L[_2_] Excel Discussion (Misc queries) 1 November 22nd 07 12:58 AM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM
Macro to highlight cells based on content JimDerDog Excel Worksheet Functions 1 February 1st 06 03:51 PM
How to check a cell for content before running macro. Incoherent Excel Programming 1 October 7th 05 04:42 PM


All times are GMT +1. The time now is 12:44 PM.

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

About Us

"It's about Microsoft Excel"