Okay, I've modified the code to add the blanks part. But the only thing
its doing that I can't seem to figure out is the same thing it was doing
with Mike's code above. I must be doing something wrong here. Its not
deleting the rows where k=0000 and its not deleting the rows where k is
blank which is what I want, that part is perfect. But when k has a
value that's not 0000 I wanted it to delete those rows where M Date -
9. Its almost as if it doesnt even look at column M and it deletes the
row anyway. Here's my code right now (Ignore the put the letter x in
the x column part)
Code:
--------------------
Public Sub Test03()
Dim sh As Worksheet
Dim i As Long
Dim Lrow As Long
Dim rng As Range
Set sh = Sheets("S2661060") '<<====== CHANGE
Lrow = Cells(Rows.Count, "A").End(xlUp).Row
'Finds the number of rows in column K - if this is not a
'good column to determine the length of your list then use a column that will.
For i = Lrow To 2 Step -1 'Loops from bottom to top- stops @ row 2.
Set rng = Range("K" & i)
If Not IsEmpty(rng) Then
If rng.Value < "0000" And rng.Value < "" Then
If rng.Offset(0, 2).Value Now - 9 Then
'rng.EntireRow.Delete
'this will put the letter x in rows that are selected for deletion
Range("X" & i).Select
ActiveCell.FormulaR1C1 = "x"
With ActiveCell.Characters(Start:=1, Length:=1).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
'end put the letter x in rows that are selected for deletion
End If
End If
End If
Next
End Sub
--------------------
--
DKY
------------------------------------------------------------------------
DKY's Profile:
http://www.excelforum.com/member.php...o&userid=14515
View this thread:
http://www.excelforum.com/showthread...hreadid=387731