Bom dia!!
Segue
Sub AleVBA_25569()
Dim sh As Worksheet, lr As Long
Set sh = Sheets(1)
lr = sh.Cells(Rows.Count, 1).End(xlUp).Row
With Columns("A:D")
ActiveWorkbook.Worksheets("Plan2").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Plan2").Sort.SortFields.Add Key:=Range("A2:A22"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Plan2").Sort.SortFields.Add Key:=Range("B2:B22"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Plan2").Sort
.SetRange Range("A1:D" & lr)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End With
ActiveSheet.Range("A1:D" & lr).RemoveDuplicates Columns:=1, Header:=xlYes
End Sub
Obs: Recorte a coluna C e cole no lugar da coluna B
Att
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Postado : 03/08/2017 8:17 am