Article ID: 183183
Article Last Modified on 6/17/2005
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
179216 OFF98: How to Use the Microsoft Office Installer Program
Additional query words: 8.00 XL98
Keywords: kbhowto kbprogramming KB183183