+ Reply to Thread
Results 1 to 10 of 10

Run Time Error Debug help

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    raleigh, nc
    MS-Off Ver
    Excel 2007
    Posts
    13

    Run Time Error Debug help

    I am opening a file, making a selection visible (is currently hidden), coping a Column, pasting values to a Column, closing the newly opened file (without saving) and moving the next file in the directory.

    Currently the below code doesn't work. I need help finding the run time error reason. Also, I need the code to move to the top of the next blank column.

    Any help would be really appreciated. I would rather not upload the files, but if I really need to I will.

    Regards,

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    06-19-2010
    Location
    Holywell, N Wales, UK
    MS-Off Ver
    Excel 2013
    Posts
    470

    Re: Run Time Error Debug help

    Where is the runtime error failing in your code?
    If this was helpful then please click the small star icon at the bottom left of my post. A little appreciation goes a long way.

  3. #3
    Registered User
    Join Date
    08-27-2012
    Location
    raleigh, nc
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Run Time Error Debug help

    When I step through with the Debug F8 it stops and pops the error at:

    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor
    Join Date
    06-19-2010
    Location
    Holywell, N Wales, UK
    MS-Off Ver
    Excel 2013
    Posts
    470

    Re: Run Time Error Debug help

    I have mocked this up and it seems to be working OK without any runtime error so the code seems OK.
    A couple of more Qs
    Is it failing on the first pass or subsequent passes?
    What info is given with the runtime error message e.g runtime error 13 - Subscript Out of Range?
    Check that the file causing the crash has a Worksheet within it and not just Chart sheets?

  5. #5
    Registered User
    Join Date
    08-27-2012
    Location
    raleigh, nc
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Run Time Error Debug help

    yes all workbooks have worksheets not just the information I have created.

    Run-time error '1004':
    Application-defined or object -defined error

    That is the run time error I get on first pass.

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Run Time Error Debug help

    you don't test to see if a file was found-perhaps change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  7. #7
    Registered User
    Join Date
    08-27-2012
    Location
    raleigh, nc
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Run Time Error Debug help

    i will change the code to add the error catching, but I know in the DIR there are 6 files and more are populated daily (once my code is working)

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Run Time Error Debug help

    that's the only way I could see a 1004 error on that line

  9. #9
    Registered User
    Join Date
    08-27-2012
    Location
    raleigh, nc
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Run Time Error Debug help

    after stepping back through with the error catching, I get the 1004 error at

    Please Login or Register  to view this content.

  10. #10
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Run Time Error Debug help

    very rarely a need to select or activate in your code
    Please Login or Register  to view this content.
    rather than
    Please Login or Register  to view this content.

+ 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