+ Reply to Thread
Results 1 to 3 of 3

VBA code to copy worksheets works in Excel 2003 but has resource issue in later versions

  1. #1
    Registered User
    Join Date
    02-02-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    VBA code to copy worksheets works in Excel 2003 but has resource issue in later versions

    Hi All,

    Hoping you can help. I have a piece of code which I found on a forum years ago and have been using successfully in a number of projects. The code basically gets you to select a workbook, opens it, and copies the worksheets to the matching sheets in the original workbook. Eg, opens a workbook, copies contents of worksheet 'ABCD' from the new workbook to worksheet 'ABCD' in the original workbook. It works fine when opening workbooks in 2003 format. When I run the code and open a 2007 workbook, I get an Excel error with a big red cross saying:

    * Excel cannot complete this task with available resources. Choose less data or close other applications.

    Here is the code:

    Please Login or Register  to view this content.
    I'm gathering it has something to do with the greater number of lines in the newer version so I may be trying to copy hundreds of thousands of lines instead of tens of thousands as I did in 2003.

    I'd appreciate any assistance in figuring out why this code no longer works with 2007/2010 Excel.

    Many thanks

    Trav

  2. #2
    Registered User
    Join Date
    02-02-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: VBA code to copy worksheets works in Excel 2003 but has resource issue in later versio

    Sorry forgot one part of the code, at the very end:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-02-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: VBA code to copy worksheets works in Excel 2003 but has resource issue in later versio

    Ok so I've worked out that the "SpecialCells(xlCellTypeLastCell)" is the part causing me grief. Apparently this is a bad way of finding the last cell. I think because the sheets that I'm wanting to import have formatting that extends beyond the actual data, it is trying to copy across the whole sheet instead of just the data. I have created a dummy sheet where I have deleted all rows and columns around the data, and it imports fine. The problem is that the report generates with the formatting and I don't want to have to manually go and edit it before importing the data.

    As such, I think I need to find a different way of defining the range that I am copying from one workbook to the other.

    Any help in rewording the code to do this would be greatly appreciated.

    Cheers

    Trav

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel Spreadsheet View Issue XP and 2003 versions
    By iains in forum Excel General
    Replies: 0
    Last Post: 07-20-2009, 11:08 AM
  2. VBA Code Only Works in Some Excel Versions
    By mta37 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-02-2005, 03:18 PM
  3. [SOLVED] Excel 2003 Issue with UsedRange.Copy (code works in Excel 2002)
    By TechFirm in forum Excel General
    Replies: 2
    Last Post: 01-20-2005, 10:06 PM
  4. Excel 2003 Issue with UsedRange.Copy (code works in Excel 2002)
    By TechFirm in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-20-2005, 10:06 PM

Tags for this Thread

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