+ Reply to Thread
Results 1 to 2 of 2

List Names on sheet2 ,but only names used in sheet1

  1. #1
    Registered User
    Join Date
    04-23-2005
    Posts
    7

    Question List Names on sheet2 ,but only names used in sheet1

    ListNames creates a list of names in the entire workbook. I need to list the names used in sheet1 only. I need this list of names used on sheet1 to be created on sheet2.

    Currently I am doing a ListNames on sheet1, then deleting all that end in "!REF!" because they are from other sheets then trying to copy the range of names to sheet2.

    I am also having trouble copying the range.

    Worksheets(Sheet1).Range("b4:e" & v).Select 'Copy old list
    Selection.Cut
    Worksheets(sheet2).Range("f4:i" & v).Select
    ActiveSheet.Paste

    That doesn't work!

    I would be greatful to find out how to do both, create sheet1 names on sheet2, and copy a range from sheet1 to sheet2.

  2. #2
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Hello ,

    this example list the names of the first sheet in the second sheet


    Sub listerNomsPremiereFeuille()
    Dim N As Name
    Dim PlageNom As Range
    Dim Ligne As Byte

    Ligne = 1
    On Error Resume Next

    For Each N In Worksheets(1).Parent.Names
    Set PlageNom = Nothing
    Set PlageNom = N.RefersToRange

    If Not PlageNom Is Nothing Then
    If Worksheets(1).Index = PlageNom.Worksheet.Index Then
    Worksheets(2).Cells(Ligne, 1) = N.Name
    Worksheets(2).Hyperlinks.Add Anchor:=Worksheets(2).Cells(Ligne, 1), _
    Address:="", SubAddress:=N.RefersToRange.Address(external:=True)
    Ligne = Ligne + 1
    End If
    End If
    Next N

    End Sub



    Regards ,
    michel

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1