Populate listbox on userform from another workbook

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,731
Office Version
  1. 2007
Platform
  1. Windows
I have a userform which has a Listbox.
I would like to populate this Listbox with customers names another workbook.
The selected Listbox name would then be placed in Textbox1

Some info for you for the external workbox etc

Workbook is called DR
Worksheet in question is called POSTAGE
Customers names are in column B
The population wouldnt need to list ALL from column B but say last row & up 10 rows
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
@Engberg
Ive been using this for a good while now & like to ask you a question please.
The code at present populates a userform Combobox & the values are taken from worksheet DATABASE & sheet POSTAGE.
On the POSTAGE sheet is it possible for the code to only populate the Combobox with customers names that havent had a hyperlink applied to them ?

Basically some of the customers names will have been hyperlinked & some not, so at present the code takes the last 10 customers names & puts them in combobox list.
Later on the combobox selection will have a hyperlink applied to them.
So is it possible for the code to only get the names without hyperlinks.
Thanks



VBA Code:
    With GetObject("C:\Users\Ian\Desktop\REMOTES ETC\DR\DR.xlsm") 'THIS POPULATES THE DROPDOWN FOR THE CUSTOMERS NAMES
        Set s = .Sheets("POSTAGE")
        Set b2 = s.Cells(s.Range("B" & s.UsedRange.Rows.Count + 1).End(xlUp).Row, "B")
        Set b1 = b2.Offset(-10, 0) 'THE MINUS VALUE IS HOW MANY NAMES TO BE SHOWN IN DROP DOWN LIST
        ComboBox1.List = s.Range(b1, b2).Value
       .Close 0
End With
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,173
Members
452,615
Latest member
bogeys2birdies

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