Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Sorting on relative references (XL97/WinNT4)

    I'm sure this one must have been mentioned before, but there's no way of checking at the moment!

    I want to write a macro that can be run on any selected range of cells, that will sort the contents of the selected range only by the second column of the selection. I've tried to work out if it's possible to use offset to do this, but I haven't been able to pin it down ...
    Could anyone help, please? <img src=/S/grovel.gif border=0 alt=grovel width=31 height=23>

    Many thanks!!
    Beryl M


  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Sorting on relative references (XL97/WinNT4)

    Something like this in a macro. Change other parameters as desired:

    <pre> Selection.Sort Key1:=Selection.Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom</pre>


    Steve

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Sorting on relative references (XL97/WinNT4)

    Brilliant! I knew it had to be something to do with the key, but I was obviously going in the wrong direction with offset!

    Many thanks! <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>
    Beryl M


Posting Permissions

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