# How to simplify code for multiple selected items in a ListBox?

I have a form with 10 listboxes. I want to simplify the code to select and deselect items in the listbox. This is my original code:

```
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then ListBox9.AddItem ListBox1.List(i)
Next i
For i = 0 To Listbox1.ListCount - 1
If ListBox1.Selected(i) = True Then ListBox10.AddItem ListBox1.List(i,
1)
Next i
```

But I have to write that 8 times to cover the 8 different listboxes on the form. It also copies selection to listboxes 9 & 10

What I want to do is this:

```
For x = 1 To 8
For i = 0 To "ListBox" & x.ListCount - 1
If "ListBox" & x.Selected(i) = True Then ListBox9.AddItem "ListBox" &
x.List(i)
Next i
For i = 0 To ListBox & x.ListCount - 1
If ListBox & x.Selected(i) = True Then ListBox10.AddItem ListBox &
x.List(i, 1)
Next i
Next x
```

But it throws an "Invalid qualifier" fault. Any help would be appreciated Thank-you