I want in Excel (2003) to take an imported data dump and format it into a report. Most of what I have done has involved recording a macro and then customizing the code where ne
I agree with @Tim_Williams that you need to work backwards as that seems to be the issue. I would do something like this.
Sub Main()
Dim workrange As Range
Dim Firstrow As Integer
Dim Lastrow As Integer
Dim lrow As Integer
'Find first and last used row in column D
Range("D:D").Select
Firstrow = ActiveSheet.UsedRange.Cells(1).Row
Lastrow = ActiveSheet.Range("D1").Offset(Sheet1.Rows.Count - 1, 0).End(xlUp).Row
'Loop through used cells backwards and delete if needed
For lrow = Lastrow To Firstrow Step -1
Set workrange = Cells(lrow, 4)
If workrange.Value <> "VFIRE" _
And workrange.Value <> "ILBURN" _
And workrange.Value <> "SMOKEA" _
And workrange.Value <> "ST3" _
And workrange.Value <> "TA1PED" _
And workrange.Value <> "UN1" _
Then workrange.EntireRow.Delete
Next lrow
End Sub