+ Reply to Thread
Results 1 to 4 of 4

Is it possible to create named ranges based on tab names programatically?

Hybrid View

  1. #1
    Registered User
    Join Date
    08-17-2012
    Location
    home
    MS-Off Ver
    Excel 2003
    Posts
    26

    Question Is it possible to create named ranges based on tab names programatically?

    Hi there,
    I'm trying to create named ranges automatically based on the tab name, since I have more than 10 tabs in my doc.
    Each tab has exactly the same format, so a script that creates a named range based on A10:b20 on every tab would be ok.

    The named range would be called "tabAtable1", "tabAtable2","tabBtable1","tabBtable2" and so on and so forth since each tab has more than one table.

    Any leads would be appreciated.

    Cheers,

    Adri

  2. #2
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Is it possible to create named ranges based on tab names programatically?

    Adapt this to your needs:

    Sub WhatsInAName()
    Dim s As Worksheet
    For Each s In Worksheets
        s.Range("A1:B10").Name = s.Name & "TABLE1"
        s.Range("D10:D20").Name = s.Name & "TABLE2"
    Next
    End Sub
    Gary's Student

  3. #3
    Registered User
    Join Date
    08-17-2012
    Location
    home
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: Is it possible to create named ranges based on tab names programatically?

    Hey Jakobshavn, thank you so much!

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Is it possible to create named ranges based on tab names programatically?

    If you are satisfied with the solution(s) provided, please remember to mark your thread as Solved.

    New quick method:
    Select Thread Tools (above first post on page) -> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word "Title" you will see a dropdown with the words "No prefix".
    Change to "Solved"
    Click Save

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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