mercredi 20 mai 2015

Excel VBA: Checkbox element and How to count list elements

I have created a listbox using activex controls. I want to have the list be populated given a range of cells in the condition that the checkbox has been clicked and it is empty at the time of being clicked. Also, I would like to clear out the list once the checkbox is unchecked (the line of code for this is wrong, please rectify):

Private Sub CheckBox1_Click()
    If CheckBox1 = True  Then
        Listbox1.List = Range("C32:C33").Value
    ElseIf Check_Box1 = False Then
        Listbox1.List = ""
    End If
End Sub

Additionally, is there a function to count the number of elements in a given listbox?

Thanks




Aucun commentaire:

Enregistrer un commentaire