PDA

View Full Version : Sleeper: How to sort my data using VBA?



frade
05-08-2005, 03:34 PM
Hello, :hi:

I would wish automatically to filter via VBA my data present in sheet1
in the goal to obtain a table of data such as in the sheet
sheet3.

Thanks a lot for your help

Fran?ois

mdmackillop
05-08-2005, 04:01 PM
Hi Francois,
Try the following


Sub SortCols()
Columns("A:D").Select
Range("D1").Activate
Selection.Sort Key1:=Range("C2"), Order1:=xlAscending, Key2:=Range("B2") _
, Order2:=xlAscending, Key3:=Range("A2"), Order3:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
xlSortNormal
Range("A1").Select
End Sub