jasonwooten
Technical User
I ahve a spreadsheet that I need some help with the code please. I have PO numbers in column P, and in coulmn X I have pulled the first 2 letters out with =LEFT(X3,2).
I am wanting to delete rows of information based on the contents in X.
the range of cells is X3:X1000
I want to delete rows if they equal OJ,OK,OS,FR,BD
This is the code that I have but it does not work.
(by the way the yes I know the first part of the code sorts the contents)
Sheet1.Range("x3:x1000").Name = "n"
Application.ScreenUpdating = False
Rows("3:2000").Select
Selection.Sort Key1:=Range("N3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A2").Activate
Range("I3:I1000").Name = "n"
If n = OJ Then
Delete.EntireRow
End If
If n = OJ Then
Delete.EntireRow
End If
If n = OK Then
Delete.EntireRow
End If
If n = FR Then
Delete.EntireRow
End If
If n = BD Then
Delete.EntireRow
End If
If n = DF Then
Delete.EntireRow
End If
Application.ScreenUpdating = True
End Sub
I am wanting to delete rows of information based on the contents in X.
the range of cells is X3:X1000
I want to delete rows if they equal OJ,OK,OS,FR,BD
This is the code that I have but it does not work.
(by the way the yes I know the first part of the code sorts the contents)
Sheet1.Range("x3:x1000").Name = "n"
Application.ScreenUpdating = False
Rows("3:2000").Select
Selection.Sort Key1:=Range("N3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A2").Activate
Range("I3:I1000").Name = "n"
If n = OJ Then
Delete.EntireRow
End If
If n = OJ Then
Delete.EntireRow
End If
If n = OK Then
Delete.EntireRow
End If
If n = FR Then
Delete.EntireRow
End If
If n = BD Then
Delete.EntireRow
End If
If n = DF Then
Delete.EntireRow
End If
Application.ScreenUpdating = True
End Sub