Option Button

  • If button value is TRUE then code executes
  •  

    Private Sub CommandButton1_Click()
    If OptionButton1.Value = True Then
    Range("A1:A10").Value = "Header"
    Range("A1:E1").Value = "Header"
    Range("A1:A10").Interior.ColorIndex = 5
    ElseIf OptionButton2.Value = True Then
    Range("A1:A10").Value = "Second"
    Range("A1:E1").Value = "Second"
    Range("A1:A10").Interior.ColorIndex = 6
    ElseIf OptionButton3.Value = True Then
    Range("A1:A10").Value = "Third"
    Range("A1:E1").Value = "Third"
    Range("A1:A10").Interior.ColorIndex = 7
    End If
    End Sub

    Download The Workbook