WolfLarsen85
New Member
- Joined
- Apr 25, 2016
- Messages
- 17
I am getting a run time error 13 in my code between the **. Can anyone out there see why? For some reason the code will run and do what I want, but then spit out the error. Any help will be appreciated.
Sub Recon()
Dim i As Integer
finalrow = Sheets("Reconciliation").Range("A500").End(xlUp).Row
Sheets("Reconciliation").Activate
Sheets("Reconciliation").Range("D2:D500").ClearContents
Range("D2:D500") = "=IFERROR(INDEX($F$2:$F$500,MATCH(1,INDEX((B2 = $G$2:$G$500)*(C2=$H$2:$H$500),0,1),0)), Not Matched)"
Last = Cells(Rows.Count, "D").End(xlUp).Row
For i = Last To 1 Step -1
**If (Cells(i, "A").Value) = 0 And (Cells(i, "D").Value) = 0 Then**
Cells(i, "A") = "Delete"
End If
Next i
Last = Cells(Rows.Count, "D").End(xlUp).Row
For i = Last To 1 Step -1
If (Cells(i, "A").Value) = "Delete" Then
Cells(i, "A").EntireRow.Delete
End If
Next i
End Sub
Sub Recon()
Dim i As Integer
finalrow = Sheets("Reconciliation").Range("A500").End(xlUp).Row
Sheets("Reconciliation").Activate
Sheets("Reconciliation").Range("D2:D500").ClearContents
Range("D2:D500") = "=IFERROR(INDEX($F$2:$F$500,MATCH(1,INDEX((B2 = $G$2:$G$500)*(C2=$H$2:$H$500),0,1),0)), Not Matched)"
Last = Cells(Rows.Count, "D").End(xlUp).Row
For i = Last To 1 Step -1
**If (Cells(i, "A").Value) = 0 And (Cells(i, "D").Value) = 0 Then**
Cells(i, "A") = "Delete"
End If
Next i
Last = Cells(Rows.Count, "D").End(xlUp).Row
For i = Last To 1 Step -1
If (Cells(i, "A").Value) = "Delete" Then
Cells(i, "A").EntireRow.Delete
End If
Next i
End Sub