Thread: Listbox in form
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Listbox in form

No, you should not use parentheses here nor anywhere else where they are not
required by syntax. While it would work here without problem, doing so can
get you in trouble in other situations (by either generating errors for
calls requiring multiple arguments or generating incorrect results in ByRef
arguments used to pass values from the called code back into the calling
code).

--
Rick (MVP - Excel)


"The Code Cage Team" wrote in
message ...
Provided everything else is correct replace ".AddItem cel.Value" with
".AddItem(cel.Value)"

Regards,
The Code Cage Team
http://www.thecodecage.com/forumz/

"PA" wrote:

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