+ Reply to Thread
Results 1 to 2 of 2

Connecting two checkboxes on different sheets

  1. #1
    Registered User
    Join Date
    02-13-2005
    Posts
    64

    Connecting two checkboxes on different sheets

    Hi folks,

    I have two sets of three checkboxes on two different worksheets (in the same workbook) that I need displaying the same information.

    I tried linking both corresponding checkboxes to the same cell, but I wasn't able to link them to a cell in another worksheet. I tried linking them to local cells and using formulas in the cell to keep the checkboxes in sync. But that only worked one way. This is my most recent attempt, which also resulted in not working.

    'Sheet2 code
    Private Sub ocb_click()
    Cells(11, "a") = "='sheet1'!$A$11"
    Sheet1.clickKeyCB()
    End Sub

    'Sheet1 code
    Function clickKeyCB()
    Dim x As Boolean
    x = Cells(11, "A"): x = (x + 3) Mod 2: Cells(11, "A") = x
    End Function

    The code seemed to work, but for some reason, even though both checkboxes are both still linked to their corresponding A11 cell, the checkbox's value does not change between true or false.

    Any ideas? Maybe I am going about this the wrong way, I'm all ears to any suggestions.

  2. #2
    Tim Barlow
    Guest

    Re: Connecting two checkboxes on different sheets


    To keep it simple:

    On sheet1:
    Private Sub CheckBox1_Click()
    Sheet2.CheckBox1 = CheckBox1
    End Sub

    and on Sheet2:
    Private Sub CheckBox1_Click()
    Sheet1.CheckBox1 = CheckBox1
    End Sub

    you'll need three sets of these - one for each CheckBox.

    HTH

    Tim




    "ph8" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi folks,
    >
    > I have two sets of three checkboxes on two different worksheets (in the
    > same workbook) that I need displaying the same information.
    >
    > I tried linking both corresponding checkboxes to the same cell, but I
    > wasn't able to link them to a cell in another worksheet. I tried
    > linking them to local cells and using formulas in the cell to keep the
    > checkboxes in sync. But that only worked one way. This is my most
    > recent attempt, which also resulted in not working.
    >
    > 'Sheet2 code
    > Private Sub ocb_click()
    > Cells(11, "a") = "='sheet1'!$A$11"
    > Sheet1.clickKeyCB()
    > End Sub
    >
    > 'Sheet1 code
    > Function clickKeyCB()
    > Dim x As Boolean
    > x = Cells(11, "A"): x = (x + 3) Mod 2: Cells(11, "A") = x
    > End Function
    >
    > The code seemed to work, but for some reason, even though both
    > checkboxes are both still linked to their corresponding A11 cell, the
    > checkbox's value does not change between true or false.
    >
    > Any ideas? Maybe I am going about this the wrong way, I'm all ears to
    > any suggestions.
    >
    >
    > --
    > ph8
    > ------------------------------------------------------------------------
    > ph8's Profile:

    http://www.excelforum.com/member.php...o&userid=19871
    > View this thread: http://www.excelforum.com/showthread...hreadid=515291
    >




+ 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