I am currently using the following macro code to sort a column of data:
Selection.Sort Key1:=Range("C4"), Order1:=xlAscending, Header:=xlGuess, _
' OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
' DataOption1:=xlSortNormal
What I would like to be available to do is change the range in Key1 from a fixed location "C4" to a dynamic or changing range. Something like
Selection.Sort Key1:=Range (Cells (SC, SR)), Order1:=xlAscending, Header:=xlGuess, _
' OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
' DataOption1:=xlSortNormal
Where SC is a variable that equals the start column and SR is the start row of the data to be sorting.
SC and SR change based on other inputs and changes in my program.
Dave W.
Bookmarks