+ Reply to Thread
Results 1 to 10 of 10

Is there a Macro to enable a check box based on the content of a c

  1. #1
    Nausett
    Guest

    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. #2
    Tom Ogilvy
    Guest

    RE: 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. #3
    Nausett
    Guest

    RE: 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. #4
    Tom Ogilvy
    Guest

    RE: 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. #5
    Nausett
    Guest

    RE: 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. #6
    Tom Ogilvy
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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.



  7. #7
    Nausett
    Guest

    Re: Is there a Macro to enable a check box based on the content of

    Thanks Tom. I was able to get it to work. I was using the the wrong
    checkbox. Thanks again for all your help

    "Tom Ogilvy" wrote:

    > 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" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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.
    >
    >
    >


  8. #8
    Nausett
    Guest

    Re: Is there a Macro to enable a check box based on the content of

    I have another question. If the reference cell is formula driven, for
    example, =IF(Input!B1="Drawdown",Input!B5," "). What would I need to do to
    make the macro work?

    "Nausett" wrote:

    > Thanks Tom. I was able to get it to work. I was using the the wrong
    > checkbox. Thanks again for all your help
    >
    > "Tom Ogilvy" wrote:
    >
    > > 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" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > 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.
    > >
    > >
    > >


  9. #9
    Tom Ogilvy
    Guest

    Re: Is there a Macro to enable a check box based on the content of

    Private Sub Worksheet_Calculate()
    If Me.Range("B9").Value > 0 then
    me.checkbox1.Value = True
    else
    me.checkbox1.Value = False
    end if
    End if
    end sub

    Use the calculate event. This must be in the sheet module as well.

    --
    Regards,
    Tom Ogilvy


    "Nausett" <[email protected]> wrote in message
    news:[email protected]...
    > I have another question. If the reference cell is formula driven, for
    > example, =IF(Input!B1="Drawdown",Input!B5," "). What would I need to do

    to
    > make the macro work?
    >
    > "Nausett" wrote:
    >
    > > Thanks Tom. I was able to get it to work. I was using the the wrong
    > > checkbox. Thanks again for all your help
    > >
    > > "Tom Ogilvy" wrote:
    > >
    > > > 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" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > 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.
    > > >
    > > >
    > > >




  10. #10
    Nausett
    Guest

    Re: Is there a Macro to enable a check box based on the content of

    It worked like a charm. Thanks so much Tom.

    "Tom Ogilvy" wrote:

    > Private Sub Worksheet_Calculate()
    > If Me.Range("B9").Value > 0 then
    > me.checkbox1.Value = True
    > else
    > me.checkbox1.Value = False
    > end if
    > End if
    > end sub
    >
    > Use the calculate event. This must be in the sheet module as well.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "Nausett" <[email protected]> wrote in message
    > news:[email protected]...
    > > I have another question. If the reference cell is formula driven, for
    > > example, =IF(Input!B1="Drawdown",Input!B5," "). What would I need to do

    > to
    > > make the macro work?
    > >
    > > "Nausett" wrote:
    > >
    > > > Thanks Tom. I was able to get it to work. I was using the the wrong
    > > > checkbox. Thanks again for all your help
    > > >
    > > > "Tom Ogilvy" wrote:
    > > >
    > > > > 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" <[email protected]> wrote in message
    > > > > news:[email protected]...
    > > > > > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1