I want to take an imported data dump in Excel (2003) and format it in the report. Most of what I did included recording a macro and then tweaking the code where necessary. I have a place that requires clean code.
I have a SORTED (D) column that lists the types of incidents (e.g. vehicle fires, bumps, animal bites, etc.). I would like to read each value in column D, and if it is NOT one of the few values we are looking for, delete the entire row.
I tried several versions of the code (which I found online), and the code that produces the results closest to what I need is as follows:
Range("D:D").Select
Dim workrange As Range
Dim cell As Range
Set workrange = Intersect(Selection, ActiveSheet.UsedRange)
For Each cell In workrange
If ActiveCell.Value <> "VFIRE" _
And ActiveCell.Value <> "ILBURN" _
And ActiveCell.Value <> "SMOKEA" _
And ActiveCell.Value <> "ST3" _
And ActiveCell.Value <> "TA1PED" _
And ActiveCell.Value <> "UN1" _
Then ActiveCell.EntireRow.Delete
Next cell
End Sub
(~ 100 168), , , . , "ILBURN" "SMOKEA", "ST3", . , , .
?