Missing link

Wes

Board Regular
Joined
Jan 30, 2004
Messages
194
Hey all,

I'm struggling with this line of code. I'm trying to populate a list box from a specific form. What I have below just doesn't work. appreciate any help on this.

Private Sub UserForm_Initialize()

ListBox1.ColumnCount = 5

PROBLEM LINE:
ListBox1.RowSource = Sheets("InformationSheet").Range("A1:e20").Value
'"a1:e20"

End Sub

Wes
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

yankee428

Active Member
Joined
Apr 12, 2004
Messages
348
Looks like you have to pass it a string. try this

Code:
Private Sub UserForm_Initialize()
Dim albert As String
ListBox1.ColumnCount = 5
albert = "InformationSheet!A1:E20"
ListBox1.RowSource = albert
End Sub
 

Wes

Board Regular
Joined
Jan 30, 2004
Messages
194
Thanks yankee428 and Tazguy37.

The string code worked just fine however the suggestion from Tazguy37 also works but it selects the active sheet.

Thanks again.

Wes (y)
 

Tazguy37

MrExcel MVP
Joined
May 28, 2004
Messages
4,237
Yes, if you wanted another sheet to be used, either hard code it in, or tell the user to select it, or use ActiveSheet. (Or probably 12 other things) :LOL:
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,151,971
Messages
5,767,391
Members
425,410
Latest member
SmittyT

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
Top