Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
bw bw is offline
external usenet poster
 
Posts: 74
Default Dynamic Sort

How do I change the following code to sort by a parameter SortCol1 and SortCol2, which
contains the column identifiers by which I want to sort? For example, SortCol1 = 3 (or
"C" if if would be better), SortCol2 = 1 (or "A" if if would be better)...

Cells.Select
Application.CutCopyMode = False
Selection.Sort Key1:=Range("C2"), Order1:=xlAscending, Key2:=Range("A2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _
:=xlSortNormal

Thanks,
Bernie


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
Merge & Sort Dynamic Lists w/ Data Validation retailmessiah Excel Discussion (Misc queries) 3 August 5th 08 04:20 PM
Merge & Sort Dynamic Lists w/ Data Validation retailmessiah Excel Worksheet Functions 3 August 5th 08 04:20 PM
How to read offset cells from dynamic sort array formula? Jay Weiss Excel Discussion (Misc queries) 1 September 20th 07 07:11 PM
Dynamic column chart - auto sort on data range jimfrog Charts and Charting in Excel 0 March 29th 06 02:45 PM
dynamic sort macro across 3 linked sheets wrpalmer Excel Discussion (Misc queries) 0 December 11th 05 02:17 AM


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