+ Reply to Thread
Results 1 to 5 of 5

Copying data from one workbook to another?

  1. #1
    Registered User
    Join Date
    10-21-2010
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    33

    Copying data from one workbook to another?

    Hello

    I am trying, once again, to avoid using copy paste in my VBA code, and have run into a problem that i cant solve.

    I have a workbook called Book1, from a VBA code within this workbook i want to open another workbook, copy some data from this other workbook into the first one and close workbook two again.

    i have tried the following code but gets the failure notice:

    Run-time error '9':

    Subscript out of range

    Please Login or Register  to view this content.
    Can anybody help me please?

    /Freakazoid
    Last edited by Freakazoid; 10-29-2010 at 06:27 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copying data from one workbook to another?

    When you DEBUG at the error message, which line of code is highlighted? This error frequently means it can't find something you've defined on that line of code, like a workbook name or a sheet name is wrong or unavailable in some way.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    10-21-2010
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Copying data from one workbook to another?

    The highlighted line of code is the fourth line:

    Please Login or Register  to view this content.
    /Freakazoid

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copying data from one workbook to another?

    Maybe this:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-21-2010
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Copying data from one workbook to another?

    Thanks alot

+ 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