+ Reply to Thread
Results 1 to 3 of 3

VBA to create Named References to Spilled Ranges

  1. #1
    Forum Contributor
    Join Date
    07-01-2018
    Location
    Adelaide, South Australia
    MS-Off Ver
    Office 365, & Excel 2016 on windows 10, & 14.7 for mac, & Excel 2015 for mac
    Posts
    173

    VBA to create Named References to Spilled Ranges

    Hi all.

    I wrote a sub to automate creating Named Ranges, but I want the Named Range to dynamically refer to the spilled range.

    For example if I have a name in A1, and a spilled range in 'Sheet 1'!A$3$ that spills A3:A12, I would want the Name Range to refer to A$1$#".
    I can achieve this by manually typing into the Name Manager, but that is very tedious.

    I can get use Range("A1#") to get a reference to the correct spilled range in vba.
    But when I set the Named Range to refer to this Range object, the result is merely a named range statically referring to A3:A12.
    ie
    Please Login or Register  to view this content.
    What am I doing wrong?

    Here is my code in including an example calling sub

    Please Login or Register  to view this content.
    If my solution helped, please consider adding Rep

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: VBA to create Named References to Spilled Ranges

    Try to change like this and see how it goes.
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-01-2018
    Location
    Adelaide, South Australia
    MS-Off Ver
    Office 365, & Excel 2016 on windows 10, & 14.7 for mac, & Excel 2015 for mac
    Posts
    173

    Re: VBA to create Named References to Spilled Ranges

    Sorry, I thought I posted a reply yesterday.
    This worked perfectly. THANK YOU

    (quote with only the most import code bits)
    Quote Originally Posted by jindon View Post
    Try to change like this and see how it goes.
    Please Login or Register  to view this content.
    I had previously tried setting the string address in "RefersTo", before trying with range objects.
    The magic sauce was adding the "=". I had missed that.

    Thanks again!
    Last edited by truk2; 06-05-2023 at 10:18 PM. Reason: Neater

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Named ranges in an xlam workbook - references not being seen
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-20-2021, 05:28 AM
  2. Dynamic, Spilled, Named Ranges - how to override SPILL
    By TimB in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-24-2020, 01:53 PM
  3. [SOLVED] Absolute References using Named Ranges?
    By AstToTheRegionalMGR in forum Excel General
    Replies: 5
    Last Post: 02-10-2015, 01:59 PM
  4. Relative References Named Ranges
    By cmore in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-07-2015, 03:14 PM
  5. Print named ranges and references
    By NMullis in forum Excel General
    Replies: 2
    Last Post: 11-16-2007, 02:08 PM
  6. Named ranges: don't want absolute references
    By sonicblue in forum Excel General
    Replies: 0
    Last Post: 11-22-2005, 10:05 AM

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