SOLVED

Button that Selects string "T", "X", and "R"

%3CLINGO-SUB%20id%3D%22lingo-sub-2530816%22%20slang%3D%22en-US%22%3EButton%20that%20Selects%20string%20%22T%22%2C%20%22X%22%2C%20and%20%22R%22%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2530816%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20everyone%2C%20how%20can%20I%20create%20a%20single%20button%20that%20everytime%20i%20click%20it%2C%20it%20will%20be%20then%20select%20either%20from%20strings%20%22T%22%2C%20%22X%22%20or%22R%22%20and%20display%20it%20in%20the%20button.%20it%20actually%20corresponds%20to%20these%20wingdings%202%20font.%20Thanks%20in%20advance.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22rbalza_0-1625799451671.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F294532iF8BA8AA6E8CBB0A4%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22rbalza_0-1625799451671.png%22%20alt%3D%22rbalza_0-1625799451671.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2530816%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2531560%22%20slang%3D%22en-US%22%3ERe%3A%20Button%20that%20Selects%20string%20%22T%22%2C%20%22X%22%2C%20and%20%22R%22%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2531560%22%20slang%3D%22en-US%22%3E%3CP%3ESee%20the%20attached%20sample%20workbook.%20I%20inserted%20a%20command%20button%20from%20Form%20Controls%2C%20set%20its%20caption%20(text)%20to%20%22T%22%20and%20set%20its%20font%20to%20Wingdings%202.%3C%2FP%3E%0A%3CP%3EI%20assigned%20the%20following%20macro%20to%20the%20command%20button%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-visual%22%3E%3CCODE%3ESub%20Button1_Click()%0A%20%20%20%20With%20ActiveSheet.Buttons(%22Button%201%22)%0A%20%20%20%20%20%20%20%20Select%20Case%20.Caption%0A%20%20%20%20%20%20%20%20%20%20%20%20Case%20%22T%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20.Caption%20%3D%20%22X%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Case%20%22X%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20.Caption%20%3D%20%22R%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Case%20%22R%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20.Caption%20%3D%20%22T%22%0A%20%20%20%20%20%20%20%20End%20Select%0A%20%20%20%20End%20With%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3BYou'll%20have%20to%20allow%20macros%20when%20you%20open%20the%20workbook.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

Hi everyone, how can I create a single button that everytime i click it, it will be then select either from strings "T", "X" or"R" and display it in the button. it actually corresponds to these wingdings 2 font. Thanks in advance.

 

rbalza_0-1625799451671.png

 

 

 

 

2 Replies
best response confirmed by rbalza (Contributor)
Solution

See the attached sample workbook. I inserted a command button from Form Controls, set its caption (text) to "T" and set its font to Wingdings 2.

I assigned the following macro to the command button:

Sub Button1_Click()
    With ActiveSheet.Buttons("Button 1")
        Select Case .Caption
            Case "T"
                .Caption = "X"
            Case "X"
                .Caption = "R"
            Case "R"
                .Caption = "T"
        End Select
    End With
End Sub

 You'll have to allow macros when you open the workbook.

Sweet, thanks very much. Kudos!