Consulting

Results 1 to 2 of 2

Thread: 2003 sorting code not working in 2010

  1. #1

    2003 sorting code not working in 2010

    Hi All
    I've a bit of a wierd problem that i'm hoping someone can help me with.
    I have the following code that runs a sort in a 2003 workbook.

        Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Key2:=Range("A2") _
            , Order2:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:=False _
            , Orientation:=xlTopToBottom
    In 2003 this works fine, however when run in 2010 if i add a new row of data at the bottom of the selected range (before running the macro) that new row gets sorted to the correct position but it has a row height of zero. To make it more infuriating if i use different data it works fine.
    Has anyone come across something like this before?
    Thanks

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    That code should work in Excel 2010 (it does here) but it depends on what's currently selected at the time of execution. Do you get an error message?
    Regarding a row height of 0, do you have any other macros in the workbook, especially event-triggered ones, that could be operating on this? Look in the various modules, especially the Thisworkbook and the active sheet's code-module.
    Do you have an Autofilter on the page?
    If all else fails, post a workbook here (or link to one (omitting the http:// bit) if you aren't allowed to)
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •