I need to select a range of rows and sort that range by column D. How can I assign this task to a macro (so I can do this to lots of different ranges of rows as needed)?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you use the macro recorder in Excel to do a sort by range then you get the following code. Replace “Selection” with “Sheet1.Range(“A1:D35”), or whatever your range to sort might be, and then change Key1 to whatever column you’d like to sort by. You can also just leave “Selection” in if you want to manually pick whatever you want to be sorted by the code.