Listbox in form
You should not try to type the procedure headers in long hand; rather, use
the dropdown box on the left side of the code window to pick the object and
use the dropdown box on the right side of the code window to pick the event
procedure. If you would have done that, you would have found that the proper
header for the UserForm's Initialize event was not this...
Private Sub clients_select_Initialize()
but, rather, that it was this instead...
Private Sub UserForm_Initialize()
Also, this part of the code (the header and footer) would not have required
you to type anything (especially useful for events having long headers such
as MouseDown).
--
Rick (MVP - Excel)
"PA" wrote in message
...
Hi,
Trying to get a listbox to work in a form... but not quite there yet!
The list should read the info from a range, but it empty... The code I
am using is below
Private Sub clients_select_Initialize()
Dim rng As Range, cel As Range
Set rng = ActiveWorkbook.Sheets("clients").Range("b2:b200")
With Me.clients_select_list
.Clear
For Each cel In rng.Cells
.AddItem cel.Value
Next
End With
End Sub
thanks a million
|