Missing link

Wes

Board Regular
Joined
Jan 30, 2004
Messages
195
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

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
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
 
Upvote 0
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)
 
Upvote 0
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:
 
Upvote 0

Forum statistics

Threads
1,215,034
Messages
6,122,782
Members
449,095
Latest member
m_smith_solihull

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