+ Reply to Thread
Results 1 to 4 of 4

Selection.Sort error

  1. #1
    Registered User
    Join Date
    03-10-2005
    Posts
    6

    Selection.Sort error

    ActiveSheet.Range("C7").Select
    ActiveSheet.Range(Selection, Selection.End(xlDown)).Select


    Selection.Sort Key1:=Range("C7"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom


    In the above code, the select statements are working correctly, so the range I want is selected, however I get an error on the Selection.Sort statement every time. Any thoughts?

  2. #2
    Registered User
    Join Date
    03-10-2005
    Posts
    6

    Solved

    Ok fixed my own problem, just added an ActiveSheet. in front of the Range in the selection statement and that solved it.

    Selection.Sort Key1:=ActiveSheet.Range("C7"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

  3. #3
    Don Guillett
    Guest

    Re: Selection.Sort error

    I tested yours and it worked but you may want to try this instead

    Sub sortmyrange()
    Range("C7", Range("C7").End(xlDown)). _
    Sort Key1:=Range("C7"), Order1:=xlAscending
    End Sub

    --
    Don Guillett
    SalesAid Software
    donaldb@281.com
    "Krager" <Krager.1uslua_1125767114.9964@excelforum-nospam.com> wrote in
    message news:Krager.1uslua_1125767114.9964@excelforum-nospam.com...
    >
    > ActiveSheet.Range("C7").Select
    > ActiveSheet.Range(Selection, Selection.End(xlDown)).Select
    >
    >
    > Selection.Sort Key1:=Range("C7"), Order1:=xlAscending, Header:=xlGuess,
    > _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
    >
    >
    > In the above code, the select statements are working correctly, so the
    > range I want is selected, however I get an error on the Selection.Sort
    > statement every time. Any thoughts?
    >
    >
    > --
    > Krager
    > ------------------------------------------------------------------------
    > Krager's Profile:

    http://www.excelforum.com/member.php...o&userid=20936
    > View this thread: http://www.excelforum.com/showthread...hreadid=401705
    >




  4. #4
    Tim Williams
    Guest

    Re: Selection.Sort error

    What's the text of the error?

    Tim

    "Krager" <Krager.1uslua_1125767114.9964@excelforum-nospam.com> wrote
    in message news:Krager.1uslua_1125767114.9964@excelforum-nospam.com...
    >
    > ActiveSheet.Range("C7").Select
    > ActiveSheet.Range(Selection, Selection.End(xlDown)).Select
    >
    >
    > Selection.Sort Key1:=Range("C7"), Order1:=xlAscending,
    > Header:=xlGuess,
    > _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
    >
    >
    > In the above code, the select statements are working correctly, so
    > the
    > range I want is selected, however I get an error on the
    > Selection.Sort
    > statement every time. Any thoughts?
    >
    >
    > --
    > Krager
    > ------------------------------------------------------------------------
    > Krager's Profile:
    > http://www.excelforum.com/member.php...o&userid=20936
    > View this thread:
    > http://www.excelforum.com/showthread...hreadid=401705
    >




+ 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