ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populate a list box with named ranges..... (https://www.excelbanter.com/excel-programming/343565-populate-list-box-named-ranges.html)

Chris Salcedo

Populate a list box with named ranges.....
 
I am trying to populate a list box with all the named ranges in a
sheet. The following code gives me only the refers to portion of the
name not the name itself. What am I doing wrong ???


Private Sub UserForm_Initialize()
For Each nName In Names
Me.ListBox1.AddItem (nName)
Next nName
End Sub

Thanks

Chris


Norman Jones

Populate a list box with named ranges.....
 
Hi Chris,

Try:

'============
Private Sub UserForm_Initialize()
Dim nName As Name
For Each nName In Names
Me.ListBox1.AddItem (nName.Name)
Next nName
End Sub

'<<============


---
Regards,
Norman



"Chris Salcedo" wrote in message
oups.com...
I am trying to populate a list box with all the named ranges in a
sheet. The following code gives me only the refers to portion of the
name not the name itself. What am I doing wrong ???


Private Sub UserForm_Initialize()
For Each nName In Names
Me.ListBox1.AddItem (nName)
Next nName
End Sub

Thanks

Chris




Chris Salcedo

Populate a list box with named ranges.....
 
Well that did it. It was so simple the that I just couldnt see it...
Its time for bed......

Thanks..
Chris

zzZZZZZz...



All times are GMT +1. The time now is 07:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com