+ Reply to Thread
Results 1 to 6 of 6

Writing a routine to name a dynamic range

  1. #1
    Registered User
    Join Date
    04-24-2012
    Location
    Woodstock CT USA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Writing a routine to name a dynamic range

    Must be a simple solution... I "simply" don't see it

    The following routine should delete a named range called "Sort"from the active workbook and select an area of the active worksheet which could change with different users. Then, re-create the named range "sort"using the selection.
    As one can see, the range for the previously named range "sort", is not a variable in the active name call... this is the problem.... I need to learn a strategy that will convert the current selected range into a variable that can be used in the "add name" call.

    Once again, thanks in advance for your effort.

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    12-15-2009
    Location
    USA
    MS-Off Ver
    2003,2007,2010,2013
    Posts
    28

    Re: Writing a routine to name a dynamic range

    Perhaps:

    names.Add Name:="Sort", Refersto:=Range("A5").CurrentRegion

    (The one line replaces all)

  3. #3
    Registered User
    Join Date
    04-24-2012
    Location
    Woodstock CT USA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Writing a routine to name a dynamic range

    Very Elegant... I've been working too hard to learn the calls, functions and syntax... I found the library calls reference...but it's not intuitive enough for me... is there a better reference source for VBA?

  4. #4
    Registered User
    Join Date
    04-24-2012
    Location
    Woodstock CT USA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Writing a routine to name a dynamic range

    Very Elegant... I've been working too hard to learn the calls, functions and syntax... I found the library calls reference...but it's not intuitive enough for me... is there a better reference source for VBA?

  5. #5
    Forum Contributor
    Join Date
    01-09-2009
    Location
    Cedar Hill, Tx
    MS-Off Ver
    Excel 2003
    Posts
    200

    Re: Writing a routine to name a dynamic range

    Would be native-Excel dynamic range definition not work for you? Using the offset formula might do just that. Good Luck

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Writing a routine to name a dynamic range

    by the way
    Please Login or Register  to view this content.
    would also work.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

+ 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