ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   UserForm fill by Range (https://www.excelbanter.com/excel-programming/383850-userform-fill-range.html)

StephanieH

UserForm fill by Range
 
I have a Listbox I'd like to fill using a Range. My Range is named "Months"
and is located in cells "D1:O1"
In Rowsource, I have "Months" (no quotes)

For some reason it only displays the first value and nothing beyond that.
How do I get it to list all of the values in that range?

Tom Ogilvy

UserForm fill by Range
 
You can't use a "Horizontal" (single row) range with rowsourceand get other
than what you are experiencing.

Why not create a vertical range (Single column) or do it with code.

Private Sub Userform_Initialize()
listbox1.rowsource = ""
listbox1.List = Application.Transpose(Range("Months"))
End sub

--
Regards,
Tom Ogilvy




"StephanieH" wrote:

I have a Listbox I'd like to fill using a Range. My Range is named "Months"
and is located in cells "D1:O1"
In Rowsource, I have "Months" (no quotes)

For some reason it only displays the first value and nothing beyond that.
How do I get it to list all of the values in that range?


StephanieH

UserForm fill by Range
 
Works perfectly.

Thanks Tom.



"Tom Ogilvy" wrote:

You can't use a "Horizontal" (single row) range with rowsourceand get other
than what you are experiencing.

Why not create a vertical range (Single column) or do it with code.

Private Sub Userform_Initialize()
listbox1.rowsource = ""
listbox1.List = Application.Transpose(Range("Months"))
End sub

--
Regards,
Tom Ogilvy




"StephanieH" wrote:

I have a Listbox I'd like to fill using a Range. My Range is named "Months"
and is located in cells "D1:O1"
In Rowsource, I have "Months" (no quotes)

For some reason it only displays the first value and nothing beyond that.
How do I get it to list all of the values in that range?



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

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