View Single Post
 
Old 03-31-2018, 07:09 AM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

If you need to change button color use ActiveX buttons,
and what you indicate can be done with just one button.
Code:
Private Sub CommandButton3_Click()
' use of only one ActiveX button
With CommandButton3
    If .BackColor = vbYellow Then
        Range("A4").Formula = "=A2/2"
        .Caption = "Current division is by 2"
        .BackColor = vbCyan
    Else
        Range("A4").Formula = "=A2/3"
        .Caption = "Current division is by 3"
        .BackColor = vbYellow
    End If
End With
End Sub
Reply With Quote