Results 1 to 2 of 2

Thread: Toggle Button 3 options
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Aug 2019
    Posts
    49
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Toggle Button 3 options

    I need a macro to assign to an object button (Shape) when pressed it will toggle a specific cell value to change between PLANNED, IN-BUILD and COMPLETE. I have this code but it only gives me two options Any Help would be appreciated.

    Regards

    Jason Bing

    Private Sub CommandButton1_Click()
    With Range("A1")
    .Value = IIf(.Value = "IN-BUILD", "COMPLETE", "IN-BUILD")
    End With
    End Sub

  2. #2
    MrExcel MVP Eric W's Avatar
    Join Date
    Aug 2015
    Location
    Bountiful, UT
    Posts
    8,644
    Post Thanks / Like
    Mentioned
    42 Post(s)
    Tagged
    5 Thread(s)

    Default Re: Toggle Button 3 options

    Try:

    Code:
    Private Sub CommandButton1_Click()
    
        Select Case Range("A1").Value
            Case "PLANNED": Range("A1").Value = "IN-BUILD"
            Case "IN-BUILD": Range("A1").Value = "COMPLETE"
            Case "COMPLETE": Range("A1").Value = "PLANNED"
        End Select
        
    End Sub
    Cheers,
    Eric

    When you eliminate the impossible, whatever remains, however improbable, must be the truth.

    -Posting guidelines, forum rules, terms of use, FAQs, BB codes, See how to search the forum
    -Post a screen shot with the HTML Maker

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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