+ Reply to Thread
Results 1 to 3 of 3

Defining Name refering to dynamic range VBA?

  1. #1
    Registered User
    Join Date
    11-09-2011
    Location
    San Diego
    MS-Off Ver
    Excel 2007
    Posts
    42

    Defining Name refering to dynamic range VBA?

    OK VBA gurus, I have what I believe to be a simple problem here. I am designing a userform that creates dynamic named ranges for Data Validation. This takes the guess work out of it for my end users who are not savvy enough to name a dynamic range on their own.

    My problem is that when I get to line 53 of the code and go to assign the "refersto:=" I always wind up with quotation marks in my final refers to formula in the name manager. Consequently my equations are referenced right, but wont work because of the inclusion of extra quotes.

    the code as is produces:

    ="offset(Data!$C$27,0,0,countA(Data!$C$27:$C$1000)-0,1)"

    instead of:

    =offset(Data!$C$27,0,0,countA(Data!$C$27:$C$1000)-0,1)

    This has been frustrating the pants off me for the whole day and everything I have tried doesn't seem to fix the issue. Can you guys tell me how to get this right??


    Please Login or Register  to view this content.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Defining Name refering to dynamic range VBA?

    Hi,

    You're missing the =

    i.e.
    NewRng = "=offset(Data!" & TopRef & ",0,0,countA(Data!" & TopRef & ":$" & CurColInt & "$1000)-0,1)"
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    11-09-2011
    Location
    San Diego
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Defining Name refering to dynamic range VBA?

    I had it in there before, but it wasn't working. There must have been something else wrong also because with the = it works perfect now. Thanks. I knew it would be something simple I was just over looking.

+ 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