+ Reply to Thread
Results 1 to 35 of 35

Excel 2007 : Sorting - Message re Removed Records

  1. #1
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Sorting - Message re Removed Records

    In 2007 I have a sorting procedure. After I save and close the file and re-open it I get the following message

    "Excel found undreadable content in ... Do you wish to recover contents ..."
    I reply Yes. Then I get:

    Removed Records: Sorting from /xl/worksheets/sheet2.xml part
    If I then immediately save/close the file and re-open it without first running the sort macro, then everything is fine. There is no warning message. After I sort and do a save/close open the message returns - so clearly there's something in the sorting procedure that causes this.

    No records are lost from the sorted range despite what the message might imply.

    I don't know whether this is a factor since it seems un-related. But after I open the file and accept the warning message and before running the sort macro, if I then immediately click the 'Save' icon I'm presented with the File Save As dialog box rather than the file just being resaved. It appear that Excel is thinking this is a new file.

    Any ideas??

    Usual TIA

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430
    Can you copy the data and macro into a new workbook and re-create the problems?
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Thanks Andy,
    I'll try that as well.

    I've been selectively deleting sheets to see if I can identify where the source of the problem may lie.

    The original data was copied in from another workbook, and it has been summarised, pivoted, and filtered before it has ended up in this particular sort range, which no doubt has complicate the matter somewhat.

    I've also noticed that I was getting a message when pivoting a table referring to an external link, even though there don't appear to be any links in the workbook. Not sure whether that might be a contributing factor.

    Needless to say this is XL 2007 which seems somewhat fussy about several aspects which I don't remember being a problem in earlier versions.

    Regards

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Hi Andy - and for anyone else who's interested.

    I finally tracked down this problem.
    The sorting macro was using a line of code :
    Please Login or Register  to view this content.
    part of the macro is a loop which processes this line twice, and it was adding a second occurrence of the same sort key. Seemingly the fact that there are two instances of the same key causes the odd warning message I was getting.

    I added an initial additional line of code:

    Please Login or Register  to view this content.
    and this has sorted the problem.

    Rgds

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430
    Thanks for posting back your solution.

  6. #6
    Registered User
    Join Date
    10-15-2010
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Sorting - Message re Removed Records

    Many thanks for posting this solution.
    Saved me hours of headaches.

  7. #7
    Registered User
    Join Date
    05-20-2011
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Sorting - Message re Removed Records

    Hello Andy!

    This maybe is the answer I've been looking for. Pardon me, but where should I put the line ".Sort.SortFields.Clear"?

    Thanks!

    Joden

  8. #8
    Registered User
    Join Date
    08-31-2012
    Location
    Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Sorting - Message re Removed Records

    Still relevant after almost 4 years, this line fixed the error in Excel 2010 for me as well.
    I've put this in the next line after the .Sort.SortFields.Add bit, and gone is the error message

    Thanks!

  9. #9
    Registered User
    Join Date
    09-06-2012
    Location
    Mexico
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Excel 2007 : Sorting - Message re Removed Records

    Thanks ! It works !!

  10. #10
    Registered User
    Join Date
    08-09-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel 2007 : Sorting - Message re Removed Records

    Oh my god, thank you thank you thank you!

    This was blowing my mind for 2 days. My sort funtion (which is used by many triggers throughout my program) was receiving the sort range, 2 sort keys and 2 sort orders. On only ONE (of the many) instances of this fuction being called, the SortKey1 and SortKey2 that were being passed in were identical. I changed one of them, and now I no longer receive the dumb error when reopening the file.

    Thanks so much!

  11. #11
    Registered User
    Join Date
    11-29-2012
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Excel 2007 : Sorting - Message re Removed Records

    And 3 months later it still works! Thanks for the great advice folks!

  12. #12
    Registered User
    Join Date
    01-30-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Excel 2007 : Sorting - Message re Removed Records

    I also had the same problem. Just changed the sortkey2 so it was different from sortkey1
    and it works fine.

    Thanks so much!!

  13. #13
    Registered User
    Join Date
    08-16-2012
    Location
    Bend, Oregon
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Excel 2007 : Sorting - Message re Removed Records

    Quote Originally Posted by Richard Buttrey View Post
    Hi Andy - and for anyone else who's interested.

    I finally tracked down this problem.
    The sorting macro was using a line of code :
    Please Login or Register  to view this content.
    part of the macro is a loop which processes this line twice, and it was adding a second occurrence of the same sort key. Seemingly the fact that there are two instances of the same key causes the odd warning message I was getting.

    I added an initial additional line of code:

    Please Login or Register  to view this content.
    and this has sorted the problem.

    Rgds

    Ive attempted to place the .Sort.SortFields.Clear in several places and still error out. Can anybody help?


    Please Login or Register  to view this content.
    Last edited by arlu1201; 01-21-2014 at 09:45 AM.

  14. #14
    Registered User
    Join Date
    07-26-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Excel 2007 : Sorting - Message re Removed Records

    Lifesaver, thanks

  15. #15
    Registered User
    Join Date
    10-27-2010
    Location
    Salisbury, Maryland
    MS-Off Ver
    Excel 2010
    Posts
    41

    Re: Excel 2007 : Sorting - Message re Removed Records

    Try and add the following just after the 'End With'


    End With

    ActiveWorkbook.Worksheets("PLORD").Sort.SortFields.Clear

  16. #16
    Registered User
    Join Date
    10-08-2013
    Location
    N. Sembilan, Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Excel 2007 : Sorting - Message re Removed Records

    the solution still doesn't work for me

  17. #17
    Registered User
    Join Date
    05-19-2014
    Posts
    1

    Re: Excel 2007 : Sorting - Message re Removed Records

    Thanks for posting the solution. Saved me a lot of time and trouble!

    Darrell

  18. #18
    Registered User
    Join Date
    08-02-2014
    Location
    terrassa
    MS-Off Ver
    2010
    Posts
    1

    Re: Excel 2007 : Sorting - Message re Removed Records

    Lifesaver! Thanks a lot.

  19. #19
    Registered User
    Join Date
    10-22-2014
    Location
    England
    MS-Off Ver
    2010
    Posts
    1

    Re: Excel 2007 : Sorting - Message re Removed Records

    That's helped me out a lot. Thank you!

  20. #20
    Registered User
    Join Date
    11-27-2014
    Location
    jersey,c.i.
    MS-Off Ver
    2010
    Posts
    1

    Re: Excel 2007 : Sorting - Message re Removed Records

    7 years after the original post and this just saved my life!!

  21. #21
    Forum Contributor
    Join Date
    09-18-2014
    Location
    Pakistan
    MS-Off Ver
    2013, 2016
    Posts
    283

    Re: Excel 2007 : Sorting - Message re Removed Records

    Hi Andy - and for anyone else who's interested.

    I finally tracked down this problem.
    The sorting macro was using a line of code :
    Select Code copy to clipboard
    .Sort.SortFields.Add
    part of the macro is a loop which processes this line twice, and it was adding a second occurrence of the same sort key. Seemingly the fact that there are two instances of the same key causes the odd warning message I was getting.

    I added an initial additional line of code:

    Select Code copy to clipboard
    .Sort.SortFields.Clear
    and this has sorted the problem.

    Rgds
    Please tell me where to put this code. and can I solve the problem.
    I saved the in .xlsm and .xlsb but both have this error.
    If I transfer data to new sheet then is it possible the new work book also show this message.

    And every time I open my file excel ask me to repair the file. Why?

    Please guide me
    Don't wait for the PERFECT MOMENT
    take the moment and make it PERFECT
    Amir

  22. #22
    Registered User
    Join Date
    07-30-2014
    Location
    UK
    MS-Off Ver
    2013
    Posts
    6

    Re: Excel 2007 : Sorting - Message re Removed Records

    Thank you, thank you, thank you!!!!! Still relevant in Excel 2016!!!!!!

  23. #23
    Registered User
    Join Date
    04-25-2017
    Location
    London
    MS-Off Ver
    2010
    Posts
    1

    Re: Excel 2007 : Sorting - Message re Removed Records

    Quote Originally Posted by sspatriots View Post
    Try and add the following just after the 'End With'


    End With

    ActiveWorkbook.Worksheets("NameOfActiveSheet").Sort.SortFields.Clear
    This worked, thank you.

  24. #24
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,698

    Re: Excel 2007 : Sorting - Message re Removed Records

    Yet another a$$ saved by this advice! Thanks Richard!
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  25. #25
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Excel 2007 : Sorting - Message re Removed Records

    Quote Originally Posted by 6StringJazzer View Post
    Yet another a$$ saved by this advice! Thanks Richard!
    Thanks Jeff - and for the rep.

    I'm only too pleased that it's been of benefit to others over the last nine years.

    It's also encouraging to see that users here are using the search facility to find these things.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  26. #26
    Registered User
    Join Date
    03-26-2017
    Location
    Belgium
    MS-Off Ver
    2013
    Posts
    2

    Re: Excel 2007 : Sorting - Message re Removed Records

    Hi all,

    I have the same issue. I have several sheets with sorting, but the error is referring to 'tabel 1'. And sheet "LTSB" is also the one who is open on saving. so I suppose the problem is with this sheet.

    I did try to save as .xlsb but no solution.

    I put in the extra code mentioned in this thread, but I still keep getting this error. Anyone any suggestion ?



    Please Login or Register  to view this content.
    Last edited by perrush; 01-10-2018 at 11:42 AM. Reason: Added code tags

  27. #27
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,698

    Re: Excel 2007 : Sorting - Message re Removed Records

    perrush, welcome to the Forum. As a new member, please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member.

    We also have a rule against hijacking, which is asking a new question in an existing thread. In this case I'll give you the benefit of the doubt since your question is directly related to advice given here. You must put your line of code
    Please Login or Register  to view this content.
    at the beginning, not the end.
    Last edited by 6StringJazzer; 01-10-2018 at 11:54 AM.

  28. #28
    Registered User
    Join Date
    03-26-2017
    Location
    Belgium
    MS-Off Ver
    2013
    Posts
    2

    Re: Excel 2007 : Sorting - Message re Removed Records

    Hi 6StringJazzer, tnx for correcting my post. Will add the code-tag next time.

    I'm a little confused with your remark about adding the Sort.SortFields.Clear at the beginning and not at the end. In 2 different posts it is stated that you should add it after the 'end with'. I'm not sure what to do know.

    Maybe this has something to do with my limited capabilities in excel. But I still get this error and looking for a solution

  29. #29
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,698

    Re: Excel 2007 : Sorting - Message re Removed Records

    Quote Originally Posted by perrush View Post
    I'm a little confused with your remark about adding the Sort.SortFields.Clear at the beginning and not at the end. In 2 different posts it is stated that you should add it after the 'end with'.
    Rather than going back and forth in this thread, it will be much faster if you just try my suggestion and see if it works. Your code is different than the code that the older answer applied to, which is why we discourage asking new questions in existing threads.

    If you try my suggestion and it does not work please start a new thread and attach your file to it.

  30. #30
    Registered User
    Join Date
    10-26-2018
    Location
    Manila, Philippines
    MS-Off Ver
    2016
    Posts
    1

    Re: Excel 2007 : Sorting - Message re Removed Records

    Thank you!

  31. #31
    Registered User
    Join Date
    10-02-2019
    Location
    Hampshire, England
    MS-Off Ver
    2016
    Posts
    1

    Re: Excel 2007 : Sorting - Message re Removed Records

    Beethoven's 9th!!! Thanks for this...

  32. #32
    Registered User
    Join Date
    06-04-2012
    Location
    Waterloo, iA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Excel 2007 : Sorting - Message re Removed Records

    Still works! Even Corona can't stop us.

    Please Login or Register  to view this content.

  33. #33
    Registered User
    Join Date
    07-31-2013
    Location
    Edmonton, Alberta
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Excel 2007 : Sorting - Message re Removed Records

    Fantastic, Thank you!!!

  34. #34
    Registered User
    Join Date
    09-19-2021
    Location
    Cornwall, England
    MS-Off Ver
    2108
    Posts
    1

    Re: Excel 2007 : Sorting - Message re Removed Records

    This solution just keeps on giving! Thank you

  35. #35
    Registered User
    Join Date
    11-19-2021
    Location
    Prague
    MS-Off Ver
    2010
    Posts
    1

    Re: Excel 2007 : Sorting - Message re Removed Records

    Also helped me. Thanks a lot!

+ 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