ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can Listfillrange be used with a listbox on a form? (https://www.excelbanter.com/excel-programming/423636-can-listfillrange-used-listbox-form.html)

Simon Skelton[_2_]

Can Listfillrange be used with a listbox on a form?
 
I have a worksheet which contains a list called "Employees".

I want to use that list to populate a listbox called "lbEmployees" which is
located on a form - instead of using multiple additem entries.

I thought it would be possible to use listfillrange to achieve this goal but
cannot generate the necessary syntax to do so.

Can listfillrange be used with a listbox on a form or is it limited to being
used with a listbox embedded in a worksheet? If it can be used with a form,
what is the best syntax to use?

OssieMac

Can Listfillrange be used with a listbox on a form?
 
Hi Simon,

I think you are referring to a different type of listbox created from the
Forms Toolbar. The type used on a Userform are the type created from the
Control Tools Toolbar.

Try the following

UserForm1.lbEmployees.RowSource = "Employees"

--
Regards,

OssieMac


"Simon Skelton" wrote:

I have a worksheet which contains a list called "Employees".

I want to use that list to populate a listbox called "lbEmployees" which is
located on a form - instead of using multiple additem entries.

I thought it would be possible to use listfillrange to achieve this goal but
cannot generate the necessary syntax to do so.

Can listfillrange be used with a listbox on a form or is it limited to being
used with a listbox embedded in a worksheet? If it can be used with a form,
what is the best syntax to use?


OssieMac

Can Listfillrange be used with a listbox on a form?
 
Hi again Simon,

My previous comment "I think you are referring to a different type of
listbox created from the Forms Toolbar."

My comment above is not correct. The real answer is that some of the
properties of the textbox on a userform differ to the properties when the
textbox is on a worksheet. One of these differences is ListFillRange which
becomes RowSource when on a userform.

The code I gave you for Rowsource on a userform is correct.

--
Regards,

OssieMac


"OssieMac" wrote:

Hi Simon,

I think you are referring to a different type of listbox created from the
Forms Toolbar. The type used on a Userform are the type created from the
Control Tools Toolbar.

Try the following

UserForm1.lbEmployees.RowSource = "Employees"

--
Regards,

OssieMac


"Simon Skelton" wrote:

I have a worksheet which contains a list called "Employees".

I want to use that list to populate a listbox called "lbEmployees" which is
located on a form - instead of using multiple additem entries.

I thought it would be possible to use listfillrange to achieve this goal but
cannot generate the necessary syntax to do so.

Can listfillrange be used with a listbox on a form or is it limited to being
used with a listbox embedded in a worksheet? If it can be used with a form,
what is the best syntax to use?



All times are GMT +1. The time now is 10:31 AM.

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