+ Reply to Thread
Results 1 to 10 of 10

Runtime Error 1004 + Runtime 5

  1. #1
    Forum Contributor
    Join Date
    11-29-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    109

    Runtime Error 1004 + Runtime 5

    Full disclosure, I have posted this code to this website twice before, and both issues were resolved.
    I am receiving a Runtime error 1004 and a runtime error 5 when I run my code. I am not sure which lines is throwing the error. Excel presents the warning but does not take me to the line causing the error.

    I am looping through a range that was generated by a pivot table, so I know the range items are valid. I am filtering said pivot tables by the range list. From there I am saving the file to a folder that exists.
    The odd part is, the code will execute (never completely) with no issue and other times (at various places in the list) it will throw the error.

    I have included my code below a sample was too big to attach (no matter what I did to shrink the file size). Any help would be greatly appreciated,



    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    47,124

    Re: Runtime Error 1004 + Runtime 5

    Sounds as though it's data related so you need to post the workbook.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    11-29-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    109

    Re: Runtime Error 1004 + Runtime 5

    I had to strip all the formatting away and delete a few lines, but this is a good representation of what the file is.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,209

    Re: Runtime Error 1004 + Runtime 5

    Quote Originally Posted by jrean042 View Post
    ... this is a good representation of what the file is ...
    No ... because there is no:

    1. "Sheet6"
    Please Login or Register  to view this content.
    2. "Sheet2"
    Please Login or Register  to view this content.
    in your file.

  5. #5
    Forum Contributor
    Join Date
    11-29-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    109

    Re: Runtime Error 1004 + Runtime 5

    I'm not sure I can reduce that file down enough to attach. Let me do my best.
    I honestly don't think that part of the code is the issue though.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    47,124

    Re: Runtime Error 1004 + Runtime 5

    Maybe zip it up?

  7. #7
    Forum Contributor
    Join Date
    11-29-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    109

    Re: Runtime Error 1004 + Runtime 5

    I think its just too big, and there are links to an Access Database, not sure how I would upload a sample file.
    Any guidance you can give without seeing the original file would help at this point.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    47,124

    Re: Runtime Error 1004 + Runtime 5

    Personally, I wouldn't have any idea what works properly, what seems to work, what might fail but go unnoticed, and what might fail, crash and burn.

    You have some Debug statements in already. I'd put a whole lot more in at different stages of the loop(s). Debug.Print relevant row numbers, cell values, variable values, etc. When it crashes, at least you'd know what row was being processed and what data was present. Then you could examine that and look for clues.

    I might also include a Stop somewhere in the loop, perhaps where you think it fails, so you can check that area of code and its associated values.

  9. #9
    Forum Contributor
    Join Date
    11-29-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    109

    Re: Runtime Error 1004 + Runtime 5

    Thank you for your help

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    47,124

    Re: Runtime Error 1004 + Runtime 5

    You're welcome.

+ 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. [SOLVED] Runtime Error 1004 and Runtime Error 13
    By Brendan_MS in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-21-2020, 10:52 AM
  2. Runtime error 1004 & runtime error 424
    By MrWhiskey in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-29-2017, 08:57 AM
  3. runtime error 1004
    By madhatter40 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-10-2014, 04:19 PM
  4. Runtime error 1004
    By janep in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-08-2010, 12:31 AM
  5. [SOLVED] What causes runtime error 1004?
    By [email protected] in forum Excel General
    Replies: 4
    Last Post: 10-27-2005, 03:05 PM
  6. Runtime Error 1004???
    By kewlrunnings in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-25-2005, 03:05 AM
  7. Runtime error 1004
    By Daniel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-19-2005, 12:05 AM

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