Team,
I need to write macro, which will be sorting two columns:
- first is ID (ID could be this some like here):
120
120
120
131
131
132
140
140
...
..
.
- second is status: Published or draft, and then
- from third columns (due date) select the max data for ID:
***example (columns with simple data)***
ID ---------- status -------------due date
120 -------- Published -------- 31-Dec-2008
120 -------- Published -------- 11-Sep-2011
120 -------- draft -------------01-Jan-2010
131 -------- Published -------- 08-Sep-2011
131 -------- Published -------- 14-Dec-2011
result should be:
120 - 11-Sep-2011
131 - 14-Dec-2011
All results should be paste in sheet2.
I just now how sort data:
Please help me with this case.
regards,
PvK
I need to write macro, which will be sorting two columns:
- first is ID (ID could be this some like here):
120
120
120
131
131
132
140
140
...
..
.
- second is status: Published or draft, and then
- from third columns (due date) select the max data for ID:
***example (columns with simple data)***
ID ---------- status -------------due date
120 -------- Published -------- 31-Dec-2008
120 -------- Published -------- 11-Sep-2011
120 -------- draft -------------01-Jan-2010
131 -------- Published -------- 08-Sep-2011
131 -------- Published -------- 14-Dec-2011
result should be:
120 - 11-Sep-2011
131 - 14-Dec-2011
All results should be paste in sheet2.
I just now how sort data:
Code:
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Add Key:=Range _
("A2:A2800"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Add Key:=Range _
("E2:E2800"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Please help me with this case.
regards,
PvK