ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sorting (https://www.excelbanter.com/excel-programming/369605-sorting.html)

T De Villiers[_98_]

Sorting
 

Hi I have a range to sort,but I need sort key to be dynamic,
so in "my version I am attempting to take range from variables
firstrow and jobcol, not quite working
thks


Standard:
Range("D117:T1328").Select
Selection.Sort Key1:=Range("T117"), Order1:=xlDescending,
Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal

My Version:
Range("D117:T1328").Select
Selection.Sort Key1:=Cells(firstrow,jobcol), Order1:=xlDescending,
Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=568986



All times are GMT +1. The time now is 09:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com