Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a named range in VBA 1

Status
Not open for further replies.

avandale

Technical User
Dec 10, 2003
7
IE
Hi Guys,

I'm using a VBA form in Excel to access staff absence files. At the momnent, I'm using the ".add item" piece of code to add a name for each person, so that they can be accessed using a drop list on the form.

Is it possible to reference a named range in Excel, so that when the named range is updated, so too will the drop down list info?

Any help would be really appreciated!!!!

 
Hi,

Create your list on a sheet in your workbook and name it.

Then, in the ComboBox properties set the RowSource property to your named range.

Hope this helps.


Leigh Moore
Solutions 4 MS Office Ltd
 
You can assign at once values in named range "TheList" to list:
[tt]Private Sub UserForm_Initialize()
Dim v As Variant
v = Range("TheList")
ComboBox1.List = v[/tt]
...

It is also possible to link the list with sheet, set control's property 'RowSource' to: =TheList

combo
 
Thansk Leighmoore,

It worked like a charm!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top