+ Reply to Thread
Results 1 to 3 of 3

Invalid reference error in VBA

  1. #1
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Invalid reference error in VBA

    I'm beginning my foray into VBA and, not suprisingly, am now stuck.
    The workbook is far too large to post, so here's some background:
    - - - - - - - - - - - - -
    I'm receiving an error in my VBA at the point where I'm attempting to sort. This is the error message:
    Please Login or Register  to view this content.
    My workbook consists of the following sheets:
    Orders
    SortSheet
    Operations
    Staging
    BWInput
    Analysis
    Summary
    I'm attempting to move/manipulate/sort data from the Orders & Operations sheets (via the SortSheet & Staging Sheets) to the BWInput sheet with this VBA:
    Please Login or Register  to view this content.
    Here are the Dynamic Range Names (DRN) I'm using:
    Please Login or Register  to view this content.
    - - - - - - - - - - - - -
    I don't know if it is the DRN that's causing the error, but I think I need to use one since the size of data block will change from run to run.
    Any suggestions?
    Last edited by ConneXionLost; 11-26-2010 at 06:16 PM.
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Invalid reference error in VBA

    Assuming this is the line that's failing
    Please Login or Register  to view this content.
    Range("A2"), refers to the active sheet, not (necessarily) the sheet on which the sort range exists (SortSheet).

    Using OFFSET in all those range definitions makes all your formulas that depend on them volatile. Consider modifying to use INDEX instead.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Invalid reference error in VBA

    That worked!

    Thx shg.

+ 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