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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a list of all named ranges within a sheet 1

Status
Not open for further replies.

Vamphyri

Technical User
Mar 18, 2005
60
US
I am a TOTAL beginner. Sorry for the simple questions.

I'm trying to figure out how to write the code to have a list generated by copying ALL named ranges within a specific worksheet onto a second sheet.

Amy help would be greatly appreciated.

Thanks Tons!
 
Hi,

You don't need code.

On a blank sheet...

Insert/Name/Paste... Paste List

Skip,

[glasses] [red]Be advised:[/red] When you ignite a firecracker in a bowl of vanilla, chocolate & strawberry ice cream, you get...
Neopolitan Blownapart! [tongue]


 
but...

if you insist
Code:
    lRow = 1
    For Each n In ActiveWorkbook.Names
        Cells(lRow, 1).Value = n.Name
        Cells(lRow, 2).Value = Right(n.RefersTo, Len(n.RefersTo) - 1)
        lRow = lRow + 1
    Next

Skip,

[glasses] [red]Be advised:[/red] When you ignite a firecracker in a bowl of vanilla, chocolate & strawberry ice cream, you get...
Neopolitan Blownapart! [tongue]


 
Skip,

Thank you. I notice you name is all over the place.

For all of us idiots just starting... Thank you.

Vamphyri
 
How would I bind this list to a combobox?
 


Assign to the ListFillRange Property, either the range reference or the NAME of the range.

Alternatively use the AddItem method to load items into the combo.

Skip,

[glasses] [red]Be advised:[/red] When you ignite a firecracker in a bowl of vanilla, chocolate & strawberry ice cream, you get...
Neopolitan Blownapart! [tongue]


 
Whenever I use these codes it returns ALL named ranges. Is there any way to return the named ranges within just one worksheet and not for the entire workbook?
 
Code:
    Dim sSheet, lRow, n
    sSheet = InputBox("Sheet name")
    lRow = 1
    For Each n In ActiveWorkbook.Names
        If Split(Right(n.RefersTo, Len(n.RefersTo) - 1), "!")(0) Like "*" & sSheet & "*" Then
            Cells(lRow, 1).Value = n.Name
            Cells(lRow, 2).Value = Right(n.RefersTo, Len(n.RefersTo) - 1)
            lRow = lRow + 1
        End If
    Next

Skip,

[glasses] [red]Be advised:[/red] When you ignite a firecracker in a bowl of vanilla, chocolate & strawberry ice cream, you get...
Neopolitan Blownapart! [tongue]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top