Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Jun 2002
    Thanked 0 Times in 0 Posts

    Row Sorting (2000)

    Hi All,
    In WOODY's OFFICE WATCH Vol 5 No 19 from 27 April 2000,
    Section 5. READER CHALLENGE - ROW SORTING RESPONSES has a great solution to a row sorting challenge. However, I need to slightly modify it and would like your help!

    Here's the deal:

    I have a worksheet almost identical to the one described in the reader challenge. However, I have additional columns of data after the sort range. In the reader challange the sort range was defined as:
    Selection.Sort Key1:=Range(ActiveCell.Address) This line tells Excel to begin with the active cell and
    select all of the cells to the end of the row of numbers (similar to using the Shift+End+Right Arrow keyboard shortcut).

    Because I have additional columns after the sort range, This won't work for me. My worksheet has 10 rows A-J. I need to only sort rows E-H, Left to Right in ascending order.

    Any ideas?

    Thanks in advance!

    Karl Keller
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Row Sorting (2000)

    Hi Karl,

    The select part in the original macro is
    <pre>Range(ActiveCell, ActiveCell.End(xlToRight)).Select</pre>

    The .End(xlToRight) extends the selection as far as possible.

    In your case, you want to select a fixed number of cells. To do this, use
    <pre>Range(ActiveCell, ActiveCell.Offset(0, 3)).Select</pre>

    The .Offset(0, 3) refers to the cell in the same row as ActiveCell, but 3 columns to the right. If you wanted to sort 7 columns, you would use .Offset(0, 6).

    Make sure cell E2 is selected when you start the macro.


Posting Permissions

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