For i = Len(Trim(Book3LastRowAddress)) To 1 Step -1 If Mid(Book3LastRowAddress, i, 1) <> "$" Then LastRowBook3 = Mid(Book3LastRowAddress, i, 1) & LastRowBook3 Else Exit For End If Next i
'Last Row Number for book4
For i = Len(Trim(Book4LastRowAddress)) To 1 Step -1 If Mid(Book4LastRowAddress, i, 1) <> "$" Then LastRowBook4 = Mid(Book4LastRowAddress, i, 1) & LastRowBook4 Else Exit For End If Next i
'Final Comparison for duplicate Records
For i = 1 To Val(LastRowBook3) For j = 1 To Val(LastRowBook4)
'Compare values and delete cell or row whatever is required
If Workbooks("book3").Sheets("Sheet1").Range("AG" & i).Value = _ Workbooks("book4").Sheets("Sheet1").Range("AG" & j).Value Then