Hello! I'm trying to write a macro that would eliminate any row if the amount column (D) equals zero. Here is the code I have so far. When I run it, it eliminates some of the rows but not all, and also eliminates all of the information in the first 5 rows up top, which I do not want it to do. I have attached a test file showing all information and the uploaded macro. Thank you so much for your time and effort helping me with this!
Sub ZeroOutRowsWhenAmountisZero() ' ZeroOutEmptyCostCodesButton Macro Dim i As Long Dim arr As Variant Set DataSheet = Sheets("Job Estimate Import") With DataSheet arr = .Range("D8:D" & FindLastRow(DataSheet, "D")) For i = 1 To UBound(arr) 'Debug.Print arr (i,1) If arr(i, 1) = "0" Then Rows(i).EntireRow.Delete End If Next End With End Sub