VBA Code to Sort Data of Varying Length!

October 27, 2023

While working on a work document, I recently figured out how to sort data of varying length (total number of rows) using VBA code. I arrived at the following code that works perfectly for my purposes for sorting data that is in 3 columns on the worksheet!

By first finding out how many rows are in column 1 (lrow), I was able to use lrow instead of a fixed number in the sort statements to get the code to automatically determine how many rows the data has and then sort it according to my specifications.

Copyright © 2011-2024 by Rajesh Gandhi. All rights reserved.

Rajesh

Posts

Copyright © 2011-2024 by Rajesh Gandhi. All rights reserved.