Hi Guys,
I have the below code written. But i'm trying to find ways to further shorter it. Could any kind soul please see if i can?
I have the below code written. But i'm trying to find ways to further shorter it. Could any kind soul please see if i can?
Code:
Sub BNP()'remove unwanted trades
Dim c As Range
Dim SrchRng
Worksheets(1).Select
Worksheets(1).Name = "XYZ"
Application.DisplayAlerts = False
Cells.EntireColumn.AutoFit
Columns("P:P").TextToColumns Destination:=Range("P1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(5, 1)), TrailingMinusNumbers:=True
SearchCol1 = "Cust"
SearchCol2 = "Source"
SearchCol3 = "Activity"
Dim rng(1 To 3) As Range
Set rng(1) = ActiveSheet.UsedRange.Find(SearchCol1, , xlValues, xlPart)
Set rng(2) = ActiveSheet.UsedRange.Find(SearchCol2, , xlValues, xlWhole)
Set rng(3) = ActiveSheet.UsedRange.Find(SearchCol3, , xlValues, xlWhole)
With Worksheets("XYZ")
.Range("A1").CurrentRegion.AutoFilter Field:=rng(1).Column, Criteria1:="11244", Operator:=xlOr, Criteria2:="NQAAA"
.Range("A1").CurrentRegion.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
.Range("A1").CurrentRegion.AutoFilter Field:=rng(1).Column, Criteria1:="WET*"
.Range("A1").CurrentRegion.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
.Range("A1").CurrentRegion.AutoFilter Field:=rng(2).Column, Criteria1:="DRY"
.Range("A1").CurrentRegion.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
.Range("A1").CurrentRegion.AutoFilter Field:=rng(3).Column, Criteria1:="C XL"
.Range("A1").CurrentRegion.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With