Jason Micahel
New Member
- Joined
- Jan 18, 2005
- Messages
- 4
I have wrote code to delete a row if the value equals something. Sample Code Below:
lRow = Cells(65536, 1).End(xlUp).Row
For z = lRow To 1 Step -1
If Cells(z, 16).Value = "OP" Then Rows(z).Delete
Next z
So in this code I am telling it to go up one row at a time, look at column 16 to see if "OP" is in the column if it is then delete the row. and repeat the next row.
Can someone please help me out with this, I am trying to write something to delete rows if the cell value is not equal to something.. And if it is possible I want to say If Cells(z, 16).Value <1 Then Rows(z).Delete
but this give me an error..
So basically I need your help with a code for not equal to a cell value then delete rows, and if cell value if less than "X" then delete rows..
Thanks in advance for your time and thoughts on this....
lRow = Cells(65536, 1).End(xlUp).Row
For z = lRow To 1 Step -1
If Cells(z, 16).Value = "OP" Then Rows(z).Delete
Next z
So in this code I am telling it to go up one row at a time, look at column 16 to see if "OP" is in the column if it is then delete the row. and repeat the next row.
Can someone please help me out with this, I am trying to write something to delete rows if the cell value is not equal to something.. And if it is possible I want to say If Cells(z, 16).Value <1 Then Rows(z).Delete
but this give me an error..
So basically I need your help with a code for not equal to a cell value then delete rows, and if cell value if less than "X" then delete rows..
Thanks in advance for your time and thoughts on this....