Hey, guys.
I put some CheckBoxes in my Form and make all of them invisible. Then I want to make only a few of them visible according to the number of Itens that the 'User' insert on a ListBox from the past Form. I also want to change the captions of these CheckBox to the same name of the itens of the ListBox.
I try this:
The CheckBoxex go until 20. My problem is: If the number of the ListBox itens is 10, I have trouble with the code UserForm2.ListBox1.List(10).
I'm a noob on VBA. Please give me some light. Thanks advance.
I put some CheckBoxes in my Form and make all of them invisible. Then I want to make only a few of them visible according to the number of Itens that the 'User' insert on a ListBox from the past Form. I also want to change the captions of these CheckBox to the same name of the itens of the ListBox.
I try this:
VBA Code:
Private Sub UserForm_Activate()
If IsNull(UserForm2.ListBox1.List(0)) Then
CheckBox1.Visible = False
Else:
CheckBox1.Caption = UserForm2.ListBox1.List(0)
End If
If IsNull(UserForm2.ListBox1.List(1)) Then
CheckBox2.Visible = False
Else:
CheckBox2.Caption = UserForm2.ListBox1.List(1)
End If
...
End Sub
The CheckBoxex go until 20. My problem is: If the number of the ListBox itens is 10, I have trouble with the code UserForm2.ListBox1.List(10).
I'm a noob on VBA. Please give me some light. Thanks advance.