+ Reply to Thread
Results 1 to 3 of 3

Code suddenly started failing - not sure why!

  1. #1
    Registered User
    Join Date
    05-16-2014
    MS-Off Ver
    Excel 2003
    Posts
    1

    Code suddenly started failing - not sure why!

    Hello all,

    Long time lurker - first time poster!

    I'm looking I'm looking for help on this very curious issue that started happening this morning.

    I have a spreadsheet that I've been using this macro with to sort a range based on specific column headers. Up until this morning - it has worked without an issue. But when I tried to run the code this morning I was greeted with the following error:

    error code.jpg

    Debugging brings me here:

    error vba.jpg


    And here is the code in full:

    Please Login or Register  to view this content.
    But here is what is confusing me the most. First - it worked just fine yesterday and all the days prior. Secondly, if the data is pasted into the workbook, saved, the workbook closed and reopened - it works just fine. If I paste it into excel and try to run the code immediately it fails.

    Where am I going wrong?


    Any help would be greatly appreciated

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Code suddenly started failing - not sure why!


    Hi,

    check first the value of the variable in the codeline where the error occurs …

  3. #3
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Code suddenly started failing - not sure why!

    Hmm there are various causes for this...

    Try qualifying range objects (Row, Columns) with parent object (i.e Worksheet).

    Sometimes it can be fixed simply by restarting your PC.

    I think latter is likely fix for you, as the code had previously worked.

    Edit: Code itself should be fine it looks like, and seeing that you have "Private". I assume it's sitting in worksheet module. So qualifying with parent object should not matter here.
    Tested on my machine and it ran fine.
    Last edited by CK76; 04-02-2020 at 09:48 AM.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

+ 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. Macro has suddenly started to run slow and consumer all resources.
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 10-01-2016, 10:28 AM
  2. [SOLVED] Macro to send Excel sheet as outlook attachmnt just started failing
    By Lbischoff in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-06-2016, 03:22 PM
  3. [SOLVED] ListBox Suddenly Failing to Load Data
    By omagoodness in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-18-2016, 09:08 AM
  4. Return to page where code was started
    By batchy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-07-2011, 06:32 AM
  5. Macro worked for 2 years, suddenly started giving strange results
    By dylanemcgregor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-21-2009, 04:39 AM
  6. Compile error has suddenly started happening
    By matpj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-05-2007, 11:38 AM
  7. [SOLVED] Error suddenly started occuring
    By Richard in forum Excel General
    Replies: 1
    Last Post: 07-14-2006, 07:40 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