Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default Sort Worksheet Records By Column

I need to write code to sort the records contained in a sheet named tracker
by column b (contains a formula that results in a numeric value) in
descending order. The row numbers change but will always start with row 3 and
end with how many ever rows have data. Also all columns will be included. I
want to prevent sorting so that blank rows are sorted to the top.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Sort Worksheet Records By Column

Does this work for you?

Sub SortMyRng()
Dim Rng as range

'Note: you must not have anything in row 2 or any cell immediately around
your Rng
' If you have headers, you may need to adjust
Set Rng = Sheets("tracker").Range("A3").CurrentRegion
Rng.Sort Key1:=Range("B3"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

"Kenny" wrote:

I need to write code to sort the records contained in a sheet named tracker
by column b (contains a formula that results in a numeric value) in
descending order. The row numbers change but will always start with row 3 and
end with how many ever rows have data. Also all columns will be included. I
want to prevent sorting so that blank rows are sorted to the top.


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
How do I sort column changes in different worksheet? chewy70 Excel Worksheet Functions 3 March 24th 09 02:26 AM
Delete records when certain records have duplicate column data JVroom New Users to Excel 1 January 26th 09 06:23 PM
how do I sort a worksheet based on one column? chipster New Users to Excel 1 September 24th 06 07:08 PM
Can I sort a column of #s Rt to left? in a worksheet Concha94 Excel Discussion (Misc queries) 1 June 1st 06 07:16 PM
Sort by column inside a worksheet flyingrhino Excel Worksheet Functions 2 April 10th 06 09:42 PM


All times are GMT +1. The time now is 04:44 PM.

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"