View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Is there an easier way to fill this listbox


"D" wrote in message
...
I want to fill it with the first row values of the active sheet . I came

up
with this but isn't there a way to set the row source value?


Public Sub Load()
Dim Rng As Range
Const rw As Long = 1

With ActiveSheet
If IsEmpty(.Cells(rw, 1)) Then
Set Rng = .Cells(rw, 1)
Else
Set Rng = .Cells(rw, Columns.Count).End(xlToLeft)(1, 2)
End If
End With

ListBox_Describe.RowSource = Rng.Address(False, False)

End Sub

Also, this is a listbox in a dialog that I want to load when the dialog
loads, is there a onload event or something that I can use to trigger

this?

There is a Userform_Activate event that fires when the form is shown, and a
Userform_Initialize event that fires when the form is loaded into memory
(but not necessarily shown).