+ Reply to Thread
Results 1 to 7 of 7

Excel cannot complete this task with available resources.

  1. #1
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Excel cannot complete this task with available resources.

    Hi,
    Can anyone give me some advise on this?
    The project i was working on yesterday was all running fine. I have not made any changes to the code and ran it today and recieve this message.

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

    Basically the code i am running filters data from a main data sheet. It then copies certain data to another sheet. It then copies further data a differnet sheet.
    It then creates 2 new workbooks with a copy of each one of these sheets with data on, in each sheet.
    Opens Outlook mail, attaches 2 new workbooks, then kills the 2 new workbooks.

    I have found it only seems to fail on the 2nd workbook. It copies the data to the sheet, creates a new workbook and then fails. It does not allow me to run through the code to find the problem.

    I think it may be because the sheet it is copying has a lot of data validation dropdown boxes and possibly causing it to crash due to too many calculations maybe? The new workbook when it was working was only about 370kb.

    Im sure its either the code or too much information to copy.

    Any ideas?

    Here is the code i am using.

    Please Login or Register  to view this content.
    Regards
    Sean

    Please add to my reputation if you think i helped
    (click on the star below the post)
    Mark threads as "Solved" if you have your answer
    (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code:
    [code] Your code here [code]
    Please supply a workbook containing example Data:
    It makes its easier to answer your problem & saves time!

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Excel cannot complete this task with available resources.

    Hello Sean Thomas,

    Have you tried to set "Application.Calculation" to manual at the beginning of your Code, and then at the end, back to "Automatic"?
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Excel cannot complete this task with available resources.

    Just tried that and it made no difference.
    Thanks anyway

  4. #4
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Excel cannot complete this task with available resources.

    Anyone else got any ideas please?

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Excel cannot complete this task with available resources.

    The new workbook when it was working was only about 370kb.
    What is the size of the WorkBook now? If it is much larger, highlight the first empty column or two to the far right of your used range/s and delete it. Repeat the process by highlighting the first couple of Rows below your used range/s and delete that as well. Then Save the WorkBook and check if the size is back to "normal".

    If that does not help. repeat the processes above and save it with a new name. Again, check if the size is back to "normal".

    If this does not solve the problem, try closing as many other applications that may be running and are not needed for your Project.

    Should that also fail, try saving your Project where the Code creates:
    Please Login or Register  to view this content.
    Hope that helps.

  6. #6
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Excel cannot complete this task with available resources.

    Thanks Wilson for your advice.

    However i have fixed it.
    my original workbook is a .xlsm of 2MB.
    The original sheet was a copy from a .xls doc. When i have copied it into my workbook, the sheets are much larger. I also noticed the original doc had data validation cells and these have been copied from top to bottom of the new doc. It also had all the list details for data validation at the very bottom. Therefore when copying the sheet, it was taking a lot of memory to copy the whole doc.

    I have now reduced the doc in size, deleted the data validation items not required (only the 1st 400 rows are ever likely to be used). Ive also moved the data validation lists to the top right.

    This now works fine.

    probably the combination of a 2MB original doc, opening outlook and creating 2 new workbooks was too much, what with the whole of the 2nd workbook to check when copying.
    Thanks anyway.

  7. #7
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Excel cannot complete this task with available resources.

    Hello Sean Thomas,

    You are welcome.

    Thank you for the feedback, and the Rep.

    Happy you got it sorted out!

+ 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