Results 1 to 3 of 3

Thread: Toggle buttons

  1. #1
    Join Date
    Sep 2003
    Posts
    228

    Unanswered: Toggle buttons

    I am having the darndest time setting up a pair of toggle buttons so only one can be true at a time. any help out there?

  2. #2
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    Suggestions for toggle button

    Code:
    Private Sub CommandButton1_Click()
        Const cCaption1 As String = "Do Action ONE"
        Const cCaption2 As String = "Do Action TWO"
        
        With CommandButton1
        
            If .Caption = cCaption1 Then
                MsgBox "Action ONE code here"
               .Caption = cCaption2
            Else
                MsgBox "Action TWO code here"
                .Caption = cCaption1
            End If
        
        End With
        
    End Sub
    Basic but it works.

    This assumes that you want differand captions depending on the toggle state !
    MTB

  3. #3
    Join Date
    Oct 2003
    Posts
    1,091
    Howdy. Are you using this in VBA or Excel?

    If in VBA, then follow Mike's advice.

    If in Excel are you using Forms toolbar or Control Toolbar? Simplest is to use the Option buttons on the Forms toolbar (and allows backward compatibility with XL97 and cross-compatibility with XL on the Mac).
    old, slow, and confused
    but at least I'm inconsistent!

    Rich
    (retired Excel 2003 user, 3/28/2008)

    How to ask a question on forums

Posting Permissions

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