Sort on 3 columns when number of rows vary daily

  • Thread starter Thread starter Tonso
  • Start date Start date
T

Tonso

I daily download data to an XL2007 workbook. The data has 30 columns. It needs to be sorted, and I use Data, Sort to sort by 1. Date, Values, A to Z, 2. Then by Type, Values, Z to A, and 3. Then by Area, Values, Smallest to Largest. This works fine. I would like to have a macro that performs this sort. Problem is, the number of rows vary daily from from a few dozen to a few hundred. How can i accomplish this sort on data that changes daily? The header info is always in row 1, and the data starts in row 2. Please note, the data imported is not appended to existing data, each day is a new worksheet called DataImp. So the data imported will always start at row 2.

Thanks,

Tonso
 
Hi Tonso,

Am Mon, 14 Jan 2013 05:17:51 -0800 (PST) schrieb Tonso:
I daily download data to an XL2007 workbook. The data has 30 columns. It needs to be sorted, and I use Data, Sort to sort by 1. Date, Values, A to Z, 2. Then by Type, Values, Z to A, and 3. Then by Area, Values, Smallest to Largest. This works fine. I would like to have a macro that performs this sort. Problem is, the number of rows vary daily from from a few dozen to a few hundred. How can i accomplish this sort on data that changes daily? The header info is always in row 1, and the data starts in row 2. Please note, the data imported is not appended to existing data, each day is a new worksheet called DataImp. So the data imported will always start at row 2.

calculate your last cell and use it with sort:

Dim LRow As Long

LRow = Cells(Rows.Count, 1).End(xlUp).Row
Range("A1:AD" & LRow).Sort.............


Regards
Claus Busch
 
Back
Top