(Solved) – Select / highlight every second pair in UserForm listbox

(solved)-–-select-/-highlight-every-second-pair-in-userform-listbox

I am wondering is there any solution to select / highlight every second pair in the list with some piece of code?

I have sat up listbox to MultiSelect:

enter image description here

And I want to achieve something like this:

enter image description here

By clicking button on UserForm:

Private Sub CommandButton1_Click()

' Select every second pair

End Sub

I have tried to play with:

Private Sub CommandButton1_Click()

' Select every second pair

sameCustomerComparison.Selected(1) = True
sameCustomerComparison.Selected(2) = True

sameCustomerComparison.Selected(5) = True
sameCustomerComparison.Selected(6) = True

End Sub

but it is giving an error…

enter image description here

Leave a Reply

Your email address will not be published. Required fields are marked *