+ Reply to Thread
Results 1 to 4 of 4

Working named ranges in multiple sheets from vba

  1. #1
    Registered User
    Join Date
    03-27-2006
    Posts
    70

    Working named ranges in multiple sheets from vba

    In the following:
    Please Login or Register  to view this content.
    Both I_Pts_2_Range and IA_MC1_r are defined as ranges
    Please Login or Register  to view this content.
    The sub they are in is initiated while on the sheet that has the ranges' addresses that follow in the first line. All the ranges and addresses that follow in the second line are on another sheet ("MC Inventory Assessment"). Each of the named ranges on the right side of the assignment are single cells.

    The first line of code runs fine, doing what it is supposed to do, but the second line blows up in an "application-defined or object-defined error". I don't get it, for I thought that the names were supposed to be work-book wide in scope. If one implementation doesn't work, then why not the other?

    Can anyone tell me what I am doing wrong and how to make it work?
    Last edited by brucemc; 08-20-2007 at 03:18 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388
    It is probably because one or both ranges is a cell in column A or row 1.

    When you use Offset(1,-1) or Offset(-1, -1) it is referring to a cell off the sheet.

  3. #3
    Registered User
    Join Date
    03-27-2006
    Posts
    70
    Wish it were the case, but I am afraid it isn't!

  4. #4
    Registered User
    Join Date
    03-27-2006
    Posts
    70
    I humbly beg everyone's pardon. T-J hit it on the head. I once again thank everyone, and apologize for not checking deeper into my code. May I blame it on getting old and having four daughters?

+ 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