ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   range name as rowsource of listbox? (https://www.excelbanter.com/excel-programming/350742-range-name-rowsource-listbox.html)

Stefi

range name as rowsource of listbox?
 
Hi All,

Can I use the name of a named range as rowsource of listbox? If so, how?
I use XL2000, and when I tried to enter the name in the rowsource field of
Properties window, I got a fatal error, that closed the whole XL application.

Thanks,
Stefi


Michael Beckinsale

range name as rowsource of listbox?
 
Yes you can and it is entered without the " marks.

If you want to do it on a form using VBA use the following code in the
Form_Initialize code window

cbxCat1.RowSource = "Category"

Replace cbxCat1 & Category with your form name and named range respectively.
Note in this instance the " marks are used.

Regards

Michael


"Stefi" wrote in message
...
Hi All,

Can I use the name of a named range as rowsource of listbox? If so, how?
I use XL2000, and when I tried to enter the name in the rowsource field of
Properties window, I got a fatal error, that closed the whole XL
application.

Thanks,
Stefi




Stefi

range name as rowsource of listbox?
 
Thanks Michael for your response, you put me on the right track.
I found that in

cbxCat1.RowSource = "Category"

cbxCat1 is to be replaced with listbox name rather then form name!

I found out that my problem was caused by using a non contiguous range in
Rowsource! HELP doesn't mention that this is not allowed!!!

Regards,
Stefi



All times are GMT +1. The time now is 12:12 PM.

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