Hello,
I have a worksheet that I have to delete rows where data isn't found via an IF formula. Unfortunately I get this worksheet weekly from an automated program and the IF formula is not coded to spit out an error if false.
This is the current formula:
I want it to be
Basically I want to be able to add the #N/A to the end of the forumla in a certain range say C1:C21.
I am doing this because I believe it is the best way to delete empty lines so I am using this code to delete the lines with #N/A
Last = Cells(Rows.Count, "D").End(xlUp).Row
For i = Last To 1 Step -1
If (Cells(i, "D").Text) = "#N/A" Then
Cells(i, "A").EntireRow.Delete
End If
Next i
End Sub
Is there a better way to do this? How would I make the VBA only look in D1:D21 instead of the entire worksheet.
Last question: What would be the best way to resize the lines without #N/A should I do that before or after I delete the #N/A lines.
Currently the way I am doing all of this is a super simple macro and referencing specific rows. The problem is the number of rows with data in them may change in the future.
THANK YOU SO MUCH!