Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default 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!!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort by color: Is there an easy way to sort columns or rows in EX MGP Excel Worksheet Functions 5 August 16th 08 11:28 AM
Sort Selection ibbm Excel Programming 4 March 28th 06 10:07 PM
Object Type of a selection... counting rows in a selection Acid-Sky[_2_] Excel Programming 3 August 23rd 05 09:53 AM
Selection.Sort not working? Avery[_2_] Excel Programming 2 May 5th 04 07:03 PM
Need a macro for selection and sort gmangad[_5_] Excel Programming 1 January 11th 04 11:44 AM


All times are GMT +1. The time now is 07:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"