+ Reply to Thread
Results 1 to 7 of 7

Resize a Dynamic Named Range

  1. #1
    Registered User
    Join Date
    04-27-2004
    Location
    El Dorado, AR
    Posts
    10

    Resize a Dynamic Named Range

    I have a sheet that I import records from an Access table in to. After the records are imported, one of the things I want to do is copy all the VOID records into another sheet. In this first sheet the data is set up as a table.

    The first time I did this, I created a named range (VoidedTickets) to use with a vlookup function in the second sheet. Everything works great.

    I imported more records from Access into the first sheet. I filtered the records so I can copy the VOID records again and add them to the second sheet. All this is done thru VBA. I can do this.

    I can increase (or Resize) the table in the first sheet with VBA.
    How can I increase the size of the named range (thru VBA) to include the added records to the range so that the vlookup function will work with the added records and not with just the old records only?
    I can increase the named range manually, but I need to do it with VBA.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Resize a Dynamic Named Range

    If it's a dynamic named range it shouldn't need resizing ... that's the whole point of a *dynamic* named range. How have you defined the range in Name Manager?

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    04-27-2004
    Location
    El Dorado, AR
    Posts
    10

    Re: Resize a Dynamic Named Range

    Quote Originally Posted by TMShucks View Post
    If it's a dynamic named range it shouldn't need resizing ... that's the whole point of a *dynamic* named range. How have you defined the range in Name Manager?

    Regards, TMS
    It is in the Name Manager.....but it's not a dynamic range, that I know of (guess I misquoted myself in the title).

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Resize a Dynamic Named Range

    Well, simple answer is ... make it a named range

    Something like:

    =$A2:INDEX($A:$A, COUNTA($A:$A)) ... it will add the sheet references.


    Regards, TMS

  5. #5
    Registered User
    Join Date
    04-27-2004
    Location
    El Dorado, AR
    Posts
    10

    Re: Resize a Dynamic Named Range

    Doesn't that just make it 1 column wide?

    The first time I did this, I created a named range (VoidedTickets) to use with a vlookup function in the second sheet. VoidedTickets = Range("$B$2:$DK$1200")
    If I add 400 rows to the sheet I want the named range (VoidedTickets) to Resize to =Range("$B$2:$DK$1600")
    It doesn't do this automatically.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Resize a Dynamic Named Range

    =$B2:INDEX($DK:$DK, COUNTA($B:$B)) ... it will add the sheet references.


    Regards, TMS

  7. #7
    Registered User
    Join Date
    04-27-2004
    Location
    El Dorado, AR
    Posts
    10

    Re: Resize a Dynamic Named Range

    Thank you....will try this.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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