+ Reply to Thread
Results 1 to 6 of 6

Two Toggle Buttons Working Together

  1. #1
    Registered User
    Join Date
    02-11-2013
    Location
    Atlanta
    MS-Off Ver
    Excel 2010
    Posts
    4

    Two Toggle Buttons Working Together

    I am trying to link 2 toggle buttons in a userform where one is set to True and the other to False, so that only one can be "active" at a time. There used to be a property that you could set, but I am not having much luck today. I want the user to be able to select "Square" or "Circle" but not both. I have code already typed to make a calculation in a cell, but need the buttons to work conversely. Thanks and sorry for elementary post.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Two Toggle Buttons Working Together

    What code have you tried?

    There is a property you can set, Value.

    Please Login or Register  to view this content.
    PS Why not use 1 togglebutton?
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-11-2013
    Location
    Atlanta
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Two Toggle Buttons Working Together

    I have the code for what the buttons do if true or false. If the user activates squaretoggle that circletoggle is inactivated. IE. If squaretoggle is true, then circletoggle becomes false, viceversa.

    Private Sub squaretoggle_Click()

    If Squaretoggle.Value = True Then

    ' Calculate square duct.

    Range("a5") = 1.4142135623731 * Range("b8")

    Else

    ' Calculate Circular duct.

    Range("a5") = 0

    End If

    End Sub


    Private Sub circletoggle_Click()

    If Circletoggle.Value = True Then

    ' Calculate circle duct.

    Range("a6") = 1.27323954473516 * Range("b8")

    Else

    ' Calculate square duct.

    Range("a6") = 0

    End If

    End Sub

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Two Toggle Buttons Working Together

    That code doesn't change the value of the toggle buttons.

  5. #5
    Registered User
    Join Date
    02-11-2013
    Location
    Atlanta
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Two Toggle Buttons Working Together

    Right, the code for the value is what I am missing, I am basically linking 2 boxes to work opposite each other. I think what you posted earlier will work, but excel locked up on me after I tried to run it. I should know in a second. Thanks

  6. #6
    Registered User
    Join Date
    02-11-2013
    Location
    Atlanta
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Two Toggle Buttons Working Together

    Thanks Norie! Working Great!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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