#1   Report Post  
Posted to microsoft.public.excel.programming
atv atv is offline
external usenet poster
 
Posts: 1
Default macro sort

HI there
Can anybody help me with a simple Macro to sort the sheet according to 3rd
column and the number of rows is not known. Please explain about the
important part of Macro too.
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default macro sort

Sub Macro1()
n = Cells(Rows.Count, 3).End(xlUp).Row
Range("A1:C" & n).Select
Selection.Sort Key1:=Range("C1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub

This just does the first three columns. The first line figures how far down
to go. The next lines selects the block to be sorted. The last actually
performs the sort.
--
Gary''s Student - gsnu200776


"atv" wrote:

HI there
Can anybody help me with a simple Macro to sort the sheet according to 3rd
column and the number of rows is not known. Please explain about the
important part of Macro too.
Thanks

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
Macro sort Excel user New Users to Excel 1 August 1st 08 08:33 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Using Macro to sort without clicking on macro button dd Excel Discussion (Misc queries) 3 May 3rd 07 06:00 PM
sort macro bijan Excel Programming 3 March 17th 07 05:48 AM
Sort Macro kronik Excel Programming 0 March 13th 06 04:55 AM


All times are GMT +1. The time now is 10:30 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"