mardi 8 mai 2018

How do I allow only one checkbox to be selected out of a group of checkboxes?

I have two groups of checkboxes.

Group 1

CheckboxA CheckboxB

Group 2

CheckboxC CheckboxD CheckboxE

How do I allow only one of the checkboxes to be selected from each group? Also is there a way to link the outcome data from a group of checkboxes?

Private Sub Worksheet_Change(ByVal Target As Range)

With ActiveSheet
    Select Case Range("H5").Value

    Case "London"
        .Shapes("CheckboxB").Visible = True
        .Shapes("CheckboxA").Visible = False

    Case "England/Wales"
        .Shapes("CheckboxA").Visible = False
        .Shapes("CheckboxB").Visible = True

    Case "Scotland"
        .Shapes("CheckboxB").Visible = False
        .Shapes("CheckboxA").Visible = True

    Case ""
        .Shapes("CheckboxA").Visible = False
        .Shapes("CheckboxB").Visible = False

    End Select

    Select Case Range("H6").Value

    Case "Pay Later"
        .Shapes("CheckboxC").Visible = True
        .Shapes("CheckboxD").Visible = True
        .Shapes("CheckboxE").Visible = True

    Case "Pay Now"
        .Shapes("CheckboxC").Visible = True
        .Shapes("CheckboxD").Visible = True
        .Shapes("CheckboxE").Visible = True

    Case "Core NSNF"
        .Shapes("CheckboxC").Visible = True
        .Shapes("CheckboxD").Visible = False
        .Shapes("CheckboxE").Visible = False

    Case "Premium NSNF"
        .Shapes("CheckboxC").Visible = False
        .Shapes("CheckboxD").Visible = False
        .Shapes("CheckboxE").Visible = False

    Case ""
        .Shapes("CheckboxC").Visible = False
        .Shapes("CheckboxD").Visible = False
        .Shapes("CheckboxE").Visible = False

    End Select

End With

End Sub




Aucun commentaire:

Enregistrer un commentaire