View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default UserForm ListBox problem

Using .list is different from using .rowsource. (And I bet you didn't mean to
use column C in the line that sets myrng to the range:

Option Explicit
Private Sub UserForm_Initialize()
Dim myRng As Range
With Worksheets("supervisors")
Set myRng = .Range("W4", .Cells(.Rows.Count, "W").End(xlUp))
'or
set myrng = .range("w4:w24") '???
End With

With Me.ListBox1
.MultiSelect = fmMultiSelectMulti 'maybe???
.ListStyle = fmListStyleOption
.rowsource = myrng.address(external:=true)
End With
....

pswanie wrote:

try this. paste it in the code of the userform. it will list all cells in w
down. u can sellect more than one option in the listbox

Private Sub UserForm_Initialize()
Dim myRng As Range
With Worksheets("supervisors")
Set myRng = .Range("W4", .Cells(.Rows.Count, "c").End(xlUp))
End With

With Me.ListBox1
.MultiSelect = fmMultiSelectMulti
.ListStyle = fmListStyleOption
.List = myRng.Value

End With

"Patrick C. Simonds" wrote:

Can any one give me the secret to entering a RowSource for a ListBox on a
UserForm?

What I want to use is Supervisors!W4:W24

I get an Invalid Property Value



--

Dave Peterson