LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sorting multiple range using a macro

Hi,

I am tyring to use a macro to sort a group of ranges C1:D20, C21:D40,
......C31:D400. i need to sort each of these ranges based on entries in
coulmn C. There are 20 ranges here. Heres the code that I use to sort
the first two ranges.....

Range("C1:D20").Select
Selection.Sort Key1:=Range("C1"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("C21:D40").Select
Selection.Sort Key1:=Range("C21"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

but i would prefer to use a for loop so that in case i change the
spreadsheet later it would be easy for me to change the code
too........

Dhanush



---
Message posted from http://www.ExcelForum.com/

 
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
sorting range Jase Excel Discussion (Misc queries) 1 September 30th 08 06:42 PM
Sorting a Range cmm Excel Discussion (Misc queries) 1 June 30th 06 01:35 PM
Sorting range multiple areas Dave Peterson[_3_] Excel Programming 0 August 12th 04 03:18 AM
Sorting range multiple areas No Name Excel Programming 0 August 11th 04 05:02 PM
Sorting Range Help HelpMe Excel Programming 4 January 8th 04 08:53 PM


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