Boa noite!!
Essa macro está um pouco melhor..
Sub Macro1()
'
' Macro1 Macro
Dim col As Long
Dim c As Range
Dim i As Long
Range("1:5").Delete
ActiveWorkbook.Worksheets("Sheet2").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet2").Sort.SortFields.Add Key:=Range("I2:I90000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet2").Sort
.SetRange Range("A1:AD90000")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
col = Cells(1, Columns.Count).End(xlToLeft).Column
For i = col To 1 Step -1
If Cells(1, i).End(xlDown).Row = Rows.Count Then
Columns(i).Delete
End If
Next
Range("H:H, K:M, S:S").Delete
[X1].Value = "AleVBA"
With Range("X2:X9999")
.Formula = "=IF(OR(COUNTIF(A2,""*""&""Local""&""*"")>0,COUNTIF(A2,""*""&""Página""&""*"")>0,COUNTIF(A2,""*""&""<Genérica>""&""*"")>0,COUNTIF(A2,""*""&""Edição Controlada Plantão Prg x Real""&""*"")>0),1,0)"
.Value = .Value
End With
With Range("$A$1:$X$9999")
.AutoFilter Field:=24, Criteria1:="1"
.Resize(Rows.Count - 1).Offset(1).EntireRow.Delete
End With
ActiveSheet.AutoFilterMode = False
End Sub
Att
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Postado : 01/11/2016 6:38 pm