+ Reply to Thread
Results 1 to 2 of 2

Indirectly referencing the name of a named range

  1. #1
    Registered User
    Join Date
    06-06-2012
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2007
    Posts
    1

    Indirectly referencing the name of a named range

    Hi and thanks in advance for your help.

    I am trying to refer to a range indirectly like the following:

    I have a range ("Ranges") that is a list of names of many other ranges. As my macro is looping through these ranges I want to be able to reference that name and look up its corresponding range.

    Please Login or Register  to view this content.

    It is giving me an error when referencing that text as a range, but if I input directly, it works fine. To be explicit,

    This works:

    Set CRange = ThisWorkbook.Sheets("Sheet1").Range("Range1")

    This doesn't:
    Set CRange = ThisWorkbook.Sheets("Sheet1").Range(ID)
    even if ID = "Range1"

    I can't reference the address because I want it to be dynamic, so I must use the name.
    Any suggestions?

    Any help would be appreciated and get me some better sleep. Thanks.

    Mod's note : code tags added for you - this time
    Last edited by FDibbins; 11-02-2012 at 08:57 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Indirectly referencing the name of a named range

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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