ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to sort a selection of rows? (https://www.excelbanter.com/excel-programming/418391-how-sort-selection-rows.html)

jgmiddel[_9_]

How to sort a selection of rows?
 
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!!

Sheeloo[_2_]

How to sort a selection of rows?
 
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

"jgmiddel" wrote:

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!!



All times are GMT +1. The time now is 12:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com