+ Reply to Thread
Results 1 to 5 of 5

Naming an undefined range

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Naming an undefined range

    I need to give a name to a range of data I'm pulling from another spreadsheet, as a precursor to doing a VLookup. I looked online and found what I thought would do the naming for me, but it's only naming the range A1. Can anyone point out what I'm doing wrong?

    I've copied the last few routines of my code so you can see what's happening. The steps are these: Filter data on the Sheet1 (in another workbook, the APRWkb workbook), copy that data to the APRdata worksheet in my active workbook, rearrange the columns, insert a formula after the pasted data, create two new row headings, format everything nice and neat, and finally try to name my range. As I've said, it appears to only be naming A1 instead of the entire selection. Can I get some help on this one?

    Thanks.
    Please Login or Register  to view this content.
    Last edited by jomili; 02-26-2010 at 04:38 PM.

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: Naming an undefined range

    Instead of this:

    Please Login or Register  to view this content.
    Try this:

    Please Login or Register  to view this content.
    Richard
    Richard Schollar
    Microsoft MVP - Excel

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Naming an undefined range

    You've described everything except what range you want to name.

    Here's what your code does:

    Locate cell A1. Find the cell at the top of the range containing A1. This will always give you A1. Then take the offset. An offset with 0,0 has no effect, not sure what the intent is.

    If you want to name the range you just selected you can do this:
    Please Login or Register  to view this content.
    This invites the question as to why you want to select that range in the first place, unless for some reason you want it set up that way for your user. If selection is not really needed then
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Naming an undefined range

    Hello jomili,

    You can set the named range to column "A" using this method:
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Naming an undefined range

    Wow! Three alternative (and apparently all correct) answers within an hour. I like that response!

    Thanks for all of your help, encouragement, and support!

+ 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