How to sort a selection of rows?

  • Thread starter Thread starter jgmiddel
  • Start date Start date
J

jgmiddel

This code selects some rows in my sheet:

With Rng.Parent
.Select
.Range("B4", LastCell).Select
End With

The number of columns and rows are variable. I want to sort the rows.
How can I do it? I am working in Excel 2007.

Any help is welcome!!
 
Use something like
Selection.Sort Key1:=Range("A1"), Order1:=xlDescending, Key2:=Range("B2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top