In Feburary 2016 03,
Launch Microsoft Excel, click the 'Developer' tab and click 'Visual Basic' to open the VBA Editor window. Click the 'Insert' menu and click 'UserForm' to create a new form. Click the 'Tools,' click 'Additional Controls,' and check the box next to 'Microsoft ListView Control' to add a new 'ListView' control to your form.
Right-click the 'ListView' control and click 'Properties.' Scroll down the properties Window and choose 'True' next to 'Checkboxes.' Click 'CommandButton' from the 'Toolbox' pane and click the form to add a new button control. Add a second button using the same technique.
Double-click 'CommandButton1' to create a click event for this button. Add the following code to populate the 'ListBox' with three items:Me.ListView1.ListItems.Add(1) = 'Check Item 1'Me.ListView1.ListItems.Add(2) = 'Check Item 2'Me.ListView1.ListItems.Add(3) = 'Check Item 3'
Switch back to your form and double-click 'CommandButton2' to create a new click event for this button. Add the following code to loop through the 'ListBox' items and print any checked items to the 'Immediate' window:For counter = 1 To Me.ListView1.ListItems.Count
If Me.ListView1.ListItems.Item(counter).Checked ThenDebug.Print Me.ListView1.ListItems.Item(counter).TextEnd IfNext
Switch back to your form and click 'F5' to run the program. Click 'CommandButton1' to populate the 'ListView' control and click 'CommandButton2' to display checked items.
In Feburary 2016 03,