![]() |
Help with Sort
I want to sort a section of a spreadsheet -
I make a selection (say range("A22:D27") I then want to sort that selection on column c then column d when I recorded the macro this is what I got: Range("A22:D27").Select Selection.Sort Key1:=Range("C22"), Order1:=xlAscending, Key2:=Range("D22" _ ), Order2:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False _ , Orientation:=xlTopToBottom The problem is that the range is hard coded with "C22" - I want a variable so I can select a range and then sort by column c then column d How can I capture the top row number of the range so I can have this as a dynamic macro? Glen |
All times are GMT +1. The time now is 12:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com