+ Reply to Thread
Results 1 to 4 of 4

On Error Resume Next not working when changing location of files

  1. #1
    Forum Contributor
    Join Date
    03-04-2014
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2019
    Posts
    756

    On Error Resume Next not working when changing location of files

    Hi all,

    I have a master spreadsheet, which is a number of tabs each with different tables on.

    On each tab there is a "button" assigned to a macro, to import data from Excel files saved in a location.

    This is an example of one of my codes:

    Please Login or Register  to view this content.
    The "button" has the following macro assigned to it:

    Please Login or Register  to view this content.
    There is the potential of 10 files called CPA1 to 10 in the relevant folder. However, there is often only 2 or 3 of them, hence the use of On Error Resume Next.

    This works perfectly fine, but I am moving this file and any corresponding files to a different location so that others users can use it. When I change the location of the files I get an error message when it cant find CPA3, 4 and so on - despite having the On Error Resume Next part of the code. Eventually after pressing ok several times I get the desired output, but this doesn't happen when the file is in its original location.

    Any idea why this is now happening?

    Many thanks,

    Chris

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: On Error Resume Next not working when changing location of files

    Using On error like that is a bad idea as it will tend to mask all problems, try changing your procedures to
    Please Login or Register  to view this content.
    and remove all the On Errors from sub CopyAll

  3. #3
    Forum Contributor
    Join Date
    03-04-2014
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2019
    Posts
    756

    Re: On Error Resume Next not working when changing location of files

    Hi Fluff13,

    I have tried your code and I get the same errors, it imports the data for CPA1 and CPA2 (as those spreadsheets exist) but then I get an error message for each of the other CPA files.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: On Error Resume Next not working when changing location of files

    If you're getting an error message in spite of On Error Resume Next, I suggest you check your error settings in the VB Editor. Tools - Options - General tab, make sure it is not set to 'Break on all errors'
    Rory

+ 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. On Error Resume Next not working
    By pcsparky in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-19-2019, 08:16 AM
  2. [SOLVED] After changing file location or renaming,custom ribbon not working
    By ImranBhatti in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-17-2016, 08:31 PM
  3. Runtime Error 53 On error resume next not working
    By KevBotes in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-01-2016, 11:07 AM
  4. On Error Resume Next not working on some PC's
    By Bishonen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-29-2015, 12:05 PM
  5. Resume Next not working
    By foxguy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-17-2010, 11:26 AM
  6. "on error resume next" NOT working...
    By Chris M in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2005, 06:05 PM
  7. Error when changing default file location
    By Lin in forum Excel General
    Replies: 0
    Last Post: 02-08-2005, 11:24 AM

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