Article ID: 161534
Article Last Modified on 11/23/2006
A1: Planes C1: Alpha
A2: Trains C2: Bravo
A3: Automobiles C3: Charlie
Private Sub UserForm_Intialize()
Dim Lrange As Range
Dim x As Variant
'Set the range to loop through
Set Lrange = Union(Sheet1.Range("A1:A3"), Sheet1.Range("C1:C3"))
'Loops through the ranges
For Each x In Lrange
'Adds an item to the list
Listbox1.AddItem x.Value
Next x
End Sub
Private Sub UserForm_Initialize()
Dim Lrange As Range
Dim Larray() As Variant
Dim x As Variant
Dim ctr As Integer
'Set the range to loop through
Set Lrange = Union(Sheet1.Range("A1:A3"), Sheet1.Range("C1:C3"))
'Loops through the ranges
For Each x In Lrange
ReDim Preserve Larray(ctr)
'Add an item to the array
Larray(ctr) = x.Value
ctr = ctr + 1
Next x
'Assign the array to the listbox
ListBox1.List = LArray
End Sub
153603 XL: Macro to Fill a List Box with Multiple Ranges
Additional query words: 97 8.00 XL97
Keywords: kbdtacode kbprogramming KB161534