List Range in Userform Listbox

SimpleSimon88

New Member
Joined
Jan 15, 2014
Messages
19
Hi again.
I am trying to find/work out how to list a range within a listbox

I can get it to work on a worksheet using Active X listbox (As it has an option for FillRange)

All I'm needing is my range displayed on a userform

example names:
Userform1
Range1

Thanks

(Image to follow to show what I mean) ...
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
use this like code ..


Private Sub UserForm_Initialize()
UserForm1.ListBox1.AddItem Range("A1:A2").Address
End Sub
 
Upvote 0
Just to solve confusion....


This returns just the range array ($B$3:$Q$5001)

This returns the above when I've altered the code to suit my code to...


Code:
[COLOR=#333333]Private Sub UserForm_Initialize()[/COLOR]
[COLOR=#333333]UserForm1.ListBox1.AddItem Range("Range1").Address[/COLOR]
[COLOR=#333333]End Sub

R[/COLOR][COLOR=#333333]ange1 =[/COLOR][COLOR=#333333] ($B$3:$Q$5001)

[/COLOR]

Simon
 
Upvote 0
Try:

Code:
Private Sub UserForm_Initialize()
With Me.ListBox1
    .List = Range("Range1").Value
    .ColumnCount = Range("Range1").Columns.Count
End With
End Sub
 
Upvote 0
ActiveSheet.Shapes("List Box 1").ControlFormat.List

this is for user form ...

Your problem is solved or it still persist ?

Let me know
</pre>
 
Upvote 0

Forum statistics

Threads
1,214,588
Messages
6,120,409
Members
448,959
Latest member
camelliaCase

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top