A
Armand
Hi evryeone i need some help to create a VBA code for delete a row with
content specific data i meade this but does't work.
let me know your answers
Thanks folks
Sub DeleteRowsBasedOnCriteria1()
With ActiveSheet
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1,
Criteria1:="127595"
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1,
Criteria1:="127597"
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1,
Criteria1:="129079"
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1,
Criteria1:="HS111"
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1, Criteria1:=" "
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1,
Criteria1:="Monterrey"
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1, Criteria1:="Dana"
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1, Criteria1:="Dana
Heavy Axl"
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1,
Criteria1:="Component"
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("a1").AutoFilter Field:=1, Criteria1:=""
.Range("a1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
End Sub
Sub DeleteRowsBasedOnCriteria2()
With ActiveSheet
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("B1").AutoFilter Field:=1,
Criteria1:="Grasa*"
.Range("B1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
End Sub
Sub DeleteRowsBasedOnCriteria3()
With ActiveSheet
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("H1").AutoFilter Field:=1, Criteria1:="<0"
.Range("H1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
End Sub
Sub DeleteRowsBasedOnCriteria4()
With ActiveSheet
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("k1").AutoFilter Field:=1, Criteria1:="0"
.Range("k1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
End Sub
Sub DeleteRowsBasedOnCriteria5()
With ActiveSheet
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("M1").AutoFilter Field:=1, Criteria1:="P"
.Range("M1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
End Sub
content specific data i meade this but does't work.
let me know your answers
Thanks folks
Sub DeleteRowsBasedOnCriteria1()
With ActiveSheet
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1,
Criteria1:="127595"
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1,
Criteria1:="127597"
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1,
Criteria1:="129079"
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1,
Criteria1:="HS111"
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1, Criteria1:=" "
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1,
Criteria1:="Monterrey"
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1, Criteria1:="Dana"
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1, Criteria1:="Dana
Heavy Axl"
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1,
Criteria1:="Component"
.Range("A1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("a1").AutoFilter Field:=1, Criteria1:=""
.Range("a1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
End Sub
Sub DeleteRowsBasedOnCriteria2()
With ActiveSheet
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("B1").AutoFilter Field:=1,
Criteria1:="Grasa*"
.Range("B1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
End Sub
Sub DeleteRowsBasedOnCriteria3()
With ActiveSheet
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("H1").AutoFilter Field:=1, Criteria1:="<0"
.Range("H1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
End Sub
Sub DeleteRowsBasedOnCriteria4()
With ActiveSheet
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("k1").AutoFilter Field:=1, Criteria1:="0"
.Range("k1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
End Sub
Sub DeleteRowsBasedOnCriteria5()
With ActiveSheet
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("M1").AutoFilter Field:=1, Criteria1:="P"
.Range("M1").CurrentRegion.Offset(1,
0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
End Sub