View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
dakota dakota is offline
external usenet poster
 
Posts: 5
Default Macro for Multiple Sorts

Using Excel 2000.
We have hundreds of rows of data that look like this:
A B C D E F G
1 Descr 1 hr 2 hrs 3 hrs 4 hrs 5 hrs 6 hrs
2 da 62
3 rf 24
4 aa 6
5 fr 5
6 cd 4
7 as 55
8 xx 14

The workbook has data in every row under column A
and one entry in one column (B-G) for each row.

We want to get a macro to perfrom multiple sorts on the
workbook so that it will look like this when finished:

A B C D E F G
1 Descr 1 hr 2 hrs 3 hrs 4 hrs 5 hrs 6 hrs
2 cd 4
3 fr 5
4 aa 6
5 as 55
6 da 62
7 xx 14
8 rf 24

We want to sort on column B. Then sort on the rest of the
worksheet on cloumn C. Then column D, E, and F.

We got the first part (the easy one) but can't figure out
how to get the macro to go to the next and succeeding
steps. After the first sort, I think that we need for the
macro to look for the first blank row under column B,
range select the rest of the worksheet and sort on C. Then
go to the first blank row under Column C, range select the
rest of the worksheet, and sort on Column D. Etc.

Range("A1").Select
Range(Selection, ActiveCell.SpecialCells
(xlLastCell)).Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom

Can someone help us here, please?