View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Incidental Incidental is offline
external usenet poster
 
Posts: 226
Default 2 Dim Arrays & List Box

Hi Roy

one way of doing it would be to check for the last used row in column
a and use that value to set your range to check and Dim your array,
the code below should work for you


Dim ListRow As Integer
Dim LastRow As Integer
Dim ListData As Variant
Dim sumName As String
Dim sumCity As String

LastRow = [A65535].End(xlUp).Row

ReDim ListData(1 To LastRow, 1 To LastRow)

For ListRow = 1 To LastRow
If Sheet1.Range("A" & ListRow) "" Then
sumCity = Sheet1.Range("C" & ListRow)
sumName = Sheet1.Range("A" & ListRow)
ListData(ListRow, 1) = sumCity
ListData(ListRow, 2) = sumName
Else
Exit For
End If
Next

lstDancer.TextAlign = fmTextAlignLeft
lstDancer.ColumnCount = 2
lstDancer.List = ListData

hope this helps

S