auto sorting

  • Thread starter Thread starter Ed
  • Start date Start date
E

Ed

Suppose I have one view of the data with the following columns:

NAME | YEARS OF SERVICE | SALARY | DEPARTMENT

I have this data in "Worksheet 1" sorted by Name, is there a way to
automatically generate other views of this data where each worksheet has
these data sorted by different columns (e.g. by YEARS OF SERVICE, by SALARY,
by DEPARTMENT)?

Thanks.
 
Ed

If you truly want 3 new worksheets with differing sorted views.

Using macro recorder produced this............

Range("A1").Select
Range("A:D").Sort Key1:=Range("A2"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Sheets("Sheet6").Copy Before:=Sheets(1)
Range("A:D").Sort Key1:=Range("B2"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Sheets("Sheet6").Copy Before:=Sheets(1)
Range("A:D").Sort Key1:=Range("C2"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Sheets("Sheet6").Copy Before:=Sheets(1)
Range("A:D").Sort Key1:=Range("D2"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub

Gord Dibben Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top