or this:
Sub dlete_rows()
Dim ws As Worksheet
Dim i As Long
Dim lastrow As Long
Set ws = Worksheets("Sheet1")
lastrow = ws.Cells(Rows.Count, "D").End(xlUp).Row
For i = lastrow To 2 Step -1
With ws.Range("D" & i)
If .Value < 96 And len(.Offset(, 1).Value) =0 Then
.EntireRow.Delete
End If
End With
Next
End Sub
--
Gary
"Gary Keramidas" <GKeramidasATmsn.com> wrote in message
news:%23L2uPHE$(E-Mail Removed)...
> you can give this a try and see if it meets your needs:
>
> Sub dlete_rows()
> Dim ws As Worksheet
> Dim i As Long
> Dim lastrow As Long
> Set ws = Worksheets("Sheet1")
> lastrow = ws.Cells(Rows.Count, "D").End(xlUp).Row
>
> For i = lastrow To 2 Step -1
> With ws.Range("D" & i)
> If .Value < 96 And .Offset(, 1).Value > "" Then
> .EntireRow.Delete
> End If
> End With
> Next
> End Sub
>
> --
>
>
> Gary
>
>
> "Steve Kellogg" <(E-Mail Removed)> wrote in message
> news:05B11510-B81C-4FD6-80F7-(E-Mail Removed)...
>>I have a spread sheet that changes nightly. In column D every cell has a
>> number. In column E there are either notes or it is blank. What I am looking
>> to do is delete any row, where the number in column D is less than 96 AND
>> there are notes in column E.
>>
>> So if D is higher than 96 and/or E is blank, I want to keep that row, delete
>> all others. On any given day I may have as few as 50 rows up to 250 rows.
>> Thanks in advance for any help.
>> --
>> Thanks Steve
>
>
|