Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Misc
Sort range must change with added lines
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Joel, post: 3071540"] The code was easy to fix. I just had to replace SELECTION with sortrange in two places. The 2nd sort was also missing a KEY to perform the sorrt Sub test() LastRow = Cells(Rows.Count, "A").End(xlUp).Row Set SortRange = Range("A6:N" & LastRow) SortRange.Sort Key1:=Range("A6"), _ Order1:=xlAscending, _ Header:=xlGuess, _ OrderCustom:=1, _ MatchCase:=False, _ Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal Sheets("Corn Yields").Select LastRow = Cells(Rows.Count, "A").End(xlUp).Row Set SortRange = Range("A6:N" & LastRow) SortRange.Sort Key1:=Range("A6"), _ Order1:=xlAscending, _ Header:=xlNo, _ OrderCustom:=1, _ MatchCase:=False, _ Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal Sheets("Policy Info").Select End Sub [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Misc
Sort range must change with added lines
Top