+ Reply to Thread
Results 1 to 4 of 4

Checkbox toggle true/false

  1. #1
    Registered User
    Join Date
    05-25-2005
    Posts
    13

    Checkbox toggle true/false

    How can I get a Checkbox to reverese its function.

    I have a check box linked to a cell and want the box to be checked when the cell is False, and clear the cell is True.

    Any help appreciated.

  2. #2
    K Dales
    Guest

    RE: Checkbox toggle true/false

    Assuming checkbox is from Forms toolbar, not control toolbox:
    Substitute your linked cell's address, the sheet name, and the CheckBox name
    in the below:

    Sub CheckBox1_Click()

    Range(LinkedCell).Value = (Sheets("Sheet1").Shapes("Check Box
    1").ControlFormat.Value <> 1)

    End Sub

    If you also need the checkbox to update when the user changes the value in
    the linked cell, you would need to do this as well in the Worksheet's code
    module:

    Private Sub Worksheet_Change(ByVal Target As Range)

    Select Case Range(LinkedCell).Value
    Case True
    Sheets("Sheet1").Shapes("Check Box 1").ControlFormat.Value = -4146
    Case False
    Sheets("Sheet1").Shapes("Check Box 1").ControlFormat.Value = 1
    End Select

    End Sub




    "Donkin" wrote:

    >
    > How can I get a Checkbox to reverese its function.
    >
    > I have a check box linked to a cell and want the box to be checked
    > when the cell is False, and clear the cell is True.
    >
    > Any help appreciated.
    >
    >
    > --
    > Donkin
    > ------------------------------------------------------------------------
    > Donkin's Profile: http://www.excelforum.com/member.php...o&userid=23715
    > View this thread: http://www.excelforum.com/showthread...hreadid=375694
    >
    >


  3. #3
    Dave Peterson
    Guest

    Re: Checkbox toggle true/false

    I'd use a helper cell and a formula that checked that linked cell:

    If A1 is the linked cell, then I'd put this in B1:

    =not(a1)

    Then use B1 for anything that I needed (hide column A if you want).

    Donkin wrote:
    >
    > How can I get a Checkbox to reverese its function.
    >
    > I have a check box linked to a cell and want the box to be checked
    > when the cell is False, and clear the cell is True.
    >
    > Any help appreciated.
    >
    > --
    > Donkin
    > ------------------------------------------------------------------------
    > Donkin's Profile: http://www.excelforum.com/member.php...o&userid=23715
    > View this thread: http://www.excelforum.com/showthread...hreadid=375694


    --

    Dave Peterson

  4. #4
    Registered User
    Join Date
    05-25-2005
    Posts
    13

    Talking

    Thanks Guys but I couldn’t get your suggestions to work but my solution is:-

    Forms Checkbox which is linked to Cell B1

    The Checkbox is assigned a Macro which inputs a formula into cell A1

    The Macro then inputs an IF function into Cell B1 with IF(A1=”Formula”,True,False)

    If the formula is in A1, B1 returns True which Checks the Checkbox

    If the User has inputted a Value in A1, B1 returns False and due to the IF function Checkbox, unchecks itself.

    Thanks for the help

+ 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