Struggling with a bit of code that's doing my head in - I'm trying to compare two worksheets and delete duplicate rows based on all the information presented. The ideal structure would be PasteCSV is compared to OriginalCSV. The macro checks for duplicate rows and then deletes the row if all the data matches - I'm attempting to pull this off with if statements, but not 100% sure if I'm doing this correctly:
Sub DeleteDuplicates()
Dim Row As Long
Dim Vendor As Range
Dim Software As Range
Dim Version As Range
Sheets("PasteCSV").Select
Columns("A").Delete
For Row = Range("A65536").End(xlUp).Row To 1 Step -1
Set Vendor = Sheets("OriginalCSV").Range("A").Find(Cells(Row, 1), LookIn:=xlValues, lookat:=xlWhole)
If Not Vendor Is Nothing Then
Set Software = Sheets("OriginalCSV").Range("B").Find(Cells(Row, 1), LookIn:=xlValues, lookat:=xlWhole)
If Not Software Is Nothing Then
Set Version = Sheets("OriginalCSV").Range("C").Find(Cells(Row, 1), LookIn:=xlValues, lookat:=xlWhole)
If Not Version Is Nothing Then
Cells(Row, 1).EntireRow.Delete
End If
Next Row
Sheets("PasteCSV").Cells.Copy
Sheets(Sheets.Count).Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
Any help would be much appreciated!
End Ifas everyIfneeds his own.