+ Reply to Thread
Results 1 to 3 of 3

naming ranges - about 500

Hybrid View

Geordie naming ranges - about 500 05-05-2010, 05:58 PM
shg Re: naming ranges - about 500 05-05-2010, 07:11 PM
Geordie Re: naming ranges - about 500 05-06-2010, 01:56 AM
  1. #1
    Forum Contributor
    Join Date
    11-18-2008
    Location
    uk
    MS-Off Ver
    Excel 2003 and Excel 2010(sometimes)
    Posts
    139

    naming ranges - about 500

    i would like to define some names for alot of ranges

    PIN1 = A5:I6
    PIN2 = A5:I7
    PIN3 = A5:I8
    etc

    up to PIN250 = A5:I505

    can this be done via vba rather than doing it manually, very time consuming

    thanks in advance
    Last edited by Geordie; 05-06-2010 at 01:56 AM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: naming ranges - about 500

    Here's one way:
    Sub x()
        Dim i As Long
        
        With ActiveSheet
            For i = 1 To 250
                .Names.Add "PIN" & i, RefersTo:=.Range("A5", .Cells(i + 5, "I"))
            Next i
        End With
    End Sub
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    11-18-2008
    Location
    uk
    MS-Off Ver
    Excel 2003 and Excel 2010(sometimes)
    Posts
    139

    Re: naming ranges - about 500

    works a treat

    thanks alot

+ 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