• Sheet Name in .address

    Author
    Topic
    #353166


    I need to get the full address (ie including the sheet name) back from a selected range.

    The following …

    range(“NamedRange”).address

    returns $A$4 (if NamedRange refers to SheetName!$A$4

    BUT BUT BUT how do I get it to return

    ‘SheetName!$A$4???

    Can someone please help (and if it turns out to be something like “.fulladdress” I am going to scream.)

    Cheers

    Tim

    Viewing 2 reply threads
    Author
    Replies
    • #515810

      Dont scream but what I think you are looking for is ActiveSheet.Name + range(“NamedRange”).address

      Hope that works, and perhaps somebody will post a more elegant solution

      Andrew

    • #515813

      Try:

      Dim sW As String
          sW = Names("sheet2!Name").RefersTo
      
      • #515814

        Of course!

        I was using ‘refersto’ to set the range name via the macro, I just didn’t think that it would be a readable property as well.

        Now, all I need to use it in ‘range().value’ is strip the “=” out – easy.

        Thanks all for you help (and the speed!!)

        • #515816

          Actually the reply was a bit slow. I had just created a VBA module to test that when they delivered my Sushi for lunch. Your answer took second place.

          Glad I could help.

    • #515873

      This simple line of code should give you the name of the worksheet of the “NamedRange”:
      Range(“NamedRange”).Parent.Name

    Viewing 2 reply threads
    Reply To: Sheet Name in .address

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: