ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   UserForm ListBox problem (https://www.excelbanter.com/excel-programming/406650-userform-listbox-problem.html)

Patrick C. Simonds

UserForm ListBox problem
 
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


Ant[_4_]

UserForm ListBox problem
 
Just happen to be doing this myself.... you need to highlight your
source and name the selection.. (next to the formular bar is the name
bar) (call it YOURVALUES or something like that) then once it's a
named source you can change the value of your listbox source input
range to =YOURVALUES (or whatever you named it)



On Feb 25, 1:35 pm, "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



pswanie

UserForm ListBox problem
 
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



JLGWhiz

UserForm ListBox problem
 
If your ListBox is on a UserForm:

1) In the Properties window of the Visual Basic Editor, with the ListBox
having focus, enter Supervisors!w4:w24 on the line provided for Row Source.

2) Using VBA code in the general code module assuming UserForm1:
UserForm1.ListBox1.RowSource = "Supervisors!w4:w24"

3) Using VBA code in the UserForm Initialize event"
ListBox1.RowSource = "Supervisors!w4:w24"

I'm not sure if it is case sensitive or not for the sheet name, but it
doesn't hurt to be sure that it is the same.

In the Properties box without quotes, in code with quotes.

"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

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


All times are GMT +1. The time now is 08:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com