+ Reply to Thread
Results 1 to 8 of 8

Excel has stopped working... after custom sort

  1. #1
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Excel has stopped working... after custom sort

    Just an FYI for others that may run into this problem. I found several others had posted the problem to various forums. I tried the various proposed fixes and none worked for my particular case.

    Anyway, my macro creates a custom sort list, sorts a range, then deletes the custom list. Excel 2010 would crash upon attempting to save the file after running the macro. I finally narrowed the cause to this line of code:

    Please Login or Register  to view this content.
    The best method I could come up with to prevent the crashing was to add the following lines:

    Please Login or Register  to view this content.
    ...where A1:A2 is an empty range.

    I'm open to a better method to prevent the crashing, but short of a better method, the above worked for me.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Excel has stopped working... after custom sort

    Just clear the sort fields after the sort.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Excel has stopped working... after custom sort

    Don't know what that means... or how to do it.

    Oh... BTW, I had read this also happens doing through the GUI... so it's not just deleting a custom list via VBA.

    And another thing... if file is saved as .xls before running code, Excel doesn't crash on save after running code.
    Last edited by jhren; 07-13-2013 at 02:26 PM.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Excel has stopped working... after custom sort

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Excel has stopped working... after custom sort

    Okay... I'll try it later (preoccupied with something else right now) and report back at that time.

    PS: Is it required to have the "wks" variable dim'd, or can I just leave it out and use ActiveWorkbook.Worksheets("<sheet name>").Sort.SortFields.Clear...?
    Last edited by jhren; 07-14-2013 at 12:05 AM.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Excel has stopped working... after custom sort

    Sure, either way.

    I'm in the habit of declaring strongly-typed object variables because it enables Intellisense, which is a godsend for people just learning VBA or the Excel OM.

  7. #7
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Excel has stopped working... after custom sort

    Quote Originally Posted by shg View Post
    Please Login or Register  to view this content.
    Quote Originally Posted by jhren View Post
    Okay... I'll try it later (preoccupied with something else right now) and report back at that time.

    ...
    Tried and confirmed it works...

    Thanks.

  8. #8
    Registered User
    Join Date
    09-19-2012
    Location
    Sarpsborg, Norge
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Excel has stopped working... after custom sort

    Thanks
    This worked for me to.

    I got the following error in event viewer:

    Faulting application name: EXCEL.EXE, version: 14.0.7104.5000, time stamp: 0x51cdffef
    Faulting module name: MSVCR90.dll, version: 9.0.30729.6161, time stamp: 0x4dace5b9
    Exception code: 0xc0000417
    Fault offset: 0x000320f0
    Faulting process id: 0x17a4
    Faulting application start time: 0x01cf79aaf1e1880a
    Faulting application path: C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE
    Faulting module path: C:\WINDOWS\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\MSVCR90.dll
    Report Id: 3c54bee8-e59e-11e3-b65e-f01faf3f25bb

+ 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. Excel has stopped working
    By micklloyd in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-11-2014, 09:47 AM
  2. [SOLVED] Custom Sort not working
    By jed38 in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 06-20-2013, 02:11 AM
  3. Excel has stopped working?
    By Aland2929 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-28-2010, 03:00 AM
  4. [SOLVED] why formulas have stopped working in Excel?
    By queenjude in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  5. excel 97 stopped working
    By john f in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-13-2005, 07:06 PM

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