Hi All,
I have 2 listboxes on sheet1 of my workbook and I was hoping their was a way to loop through them as the same code applies to them both?
My code is
i then need to apply the same code to listbox2
Is there a way of just putting something like Sheet1.ListBox & x.Selected = True
where x is 1 then 2?
Thanks
I have 2 listboxes on sheet1 of my workbook and I was hoping their was a way to loop through them as the same code applies to them both?
My code is
Code:
Dim rng As Range
MyArray = Array("A2:A5", "F2:F4")
For Each x In MyArray
n = 0
For Each rng In .Range(x)
If rng.Offset(0, 1) = True Then
Sheet1.ListBox1.Selected(n) = True
End If
n = n + 1
Next
i then need to apply the same code to listbox2
Is there a way of just putting something like Sheet1.ListBox & x.Selected = True
where x is 1 then 2?
Thanks