+ Reply to Thread
Results 1 to 3 of 3

User Selected Range Across Workbooks

  1. #1
    Registered User
    Join Date
    08-14-2008
    Location
    Idaho
    Posts
    3

    User Selected Range Across Workbooks

    I am trying to write a sub that will allow the user to select a range and a collection of files. That range will be pulled from each of the files selected and then pasted to a new workbook (same sheet). I will also be doing the same thing but instead to one sheet give each file its own sheet. I have a problem with the range. When I grab the range from the user, I can immediately select that range in the open worksheet. However, when I move over to the next workbook, it seems as if its out of scope or something. The error says object required. I have stripped the code down as much as I can to the part that is causing the problem.

    Please Login or Register  to view this content.

    Cross Posted:
    http://www.mrexcel.com/forum/showthread.php?t=336209
    http://www.xtremevbtalk.com/showthre...17#post1301417
    http://www.ozgrid.com/forum/showthre...454008#Similar
    Last edited by Mountainman141; 08-14-2008 at 02:51 PM.

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

    When you assign an object to an object variable, the object variable's Parent property is set to the Parent property of the object. A Range's parent is the Worksheet, and the worksheet's parent is the Workbook.

    You close the workbook and try to reference the range variable that points back to that workbook. Since the workbook no longer exists, you get the error "object required".

    You can reference the same range on a different sheet in a different workbook by saving the range's address in a string. Here is an example...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    08-14-2008
    Location
    Idaho
    Posts
    3
    Thanks a million. I tried that at some point, but must have messed up the syntax or something. Oh-well, works great now! Really appreciate it!

+ 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