find duplicates in different sheets

mrkasten

New Member
Joined
Jul 20, 2011
Messages
32
I am using Excel 2010 and I need to find a way to find duplicated items that are in different worksheets. One sheet is a long list of none cashed checks and each month I get a new list and I need to find a way to see if any of the checks on the original list have been cashed. The checks that have been cashed will not be on the new sheet that I get every month.
 
Last edited:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
At the moment the the columns change from sheet to sheet but I can rearrange them so the check number is in the same place on both. At the moment the check number is located in column K in the old list and column E in the new list
 
Upvote 0
Only tested in 2007.
Make a copy of your data before running this.

You will also need to change the worksheet names to Old and New or changed the code to your worksheet names

Code:
Sub ChequeRemove()
Dim wb As Workbook, oWS As Worksheet, nWS As Worksheet
Dim i As Long, LastRow As Long, LastCol As Long, nLastRow As Long
Set wb = ActiveWorkbook
Set oWS = wb.Sheets("Old")
Set nWS = wb.Sheets("New")

nLastRow = nWS.Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Row
LastRow = oWS.Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Row
LastCol = oWS.Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Column

oWS.Range(Cells(1, LastCol + 1), Cells(LastRow, LastCol + 1)).FormulaR1C1 = "=VLOOKUP(RC[" & 11 - (LastCol + 1) & "]," & nWS.Name & "!R1C5:R" & nLastRow & "C5,1,FALSE)"

For i = LastRow To 1 Step -1
    If oWS.Cells(i, (LastCol + 1)).Text = "#N/A" Then Rows(i).EntireRow.Delete
Next i
End Sub
 
Upvote 0
When i enter it after changing the names i get a box that has me open the file and pick a sheet to update from. Than no matter which sheet i click i get #NAME? in the new row. I could be entering it into the wrong spot though since this is my first time using VB.
I am using 2010 by the way.
Thanks
 
Upvote 0
O and here is what my equation to find the cashed checks
=IF(ISNA(VLOOKUP(K2, 'June 2010'!D:D, 1, 0)),"Cashed","")
 
Upvote 0
When i enter it after changing the names i get a box that has me open the file and pick a sheet to update from. Than no matter which sheet i click i get #NAME? in the new row. I could be entering it into the wrong spot though since this is my first time using VB.
I am using 2010 by the way.
Thanks

Post the code how it appears once you made your changes
 
Upvote 0
Sub ChequeRemove()
Dim wb As Workbook, oWS As Worksheet, nWS As Worksheet
Dim i As Long, LastRow As Long, LastCol As Long, nLastRow As Long
Set wb = ActiveWorkbook
Set oWS = wb.Sheets("Outstanding ST Loans")
Set nWS = wb.Sheets("June 2010")

nLastRow = nWS.Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Row
LastRow = oWS.Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Row
LastCol = oWS.Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Column

oWS.Range(Cells(1, LastCol + 1), Cells(LastRow, LastCol + 1)).FormulaR1C1 = "=VLOOKUP(RC[" & 11 - (LastCol + 1) & "]," & nWS.Name & "!R1C5:R" & nLastRow & "C5,1,FALSE)"

For i = LastRow To 1 Step -1
If oWS.Cells(i, (LastCol + 1)).Text = "Cashed" Then Rows(i).EntireRow.Delete
Next i
End Sub
 
Upvote 0
Code:
Sub ChequeRemove()
Dim wb As Workbook, oWS As Worksheet, nWS As Worksheet
Dim i As Long, LastRow As Long, LastCol As Long, nLastRow As Long
Set wb = ActiveWorkbook
Set oWS = wb.Sheets("Outstanding ST Loans")
Set nWS = wb.Sheets("June 2010")

nLastRow = nWS.Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Row
LastRow = oWS.Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Row
LastCol = oWS.Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Column

oWS.Range(Cells(1, LastCol + 1), Cells(LastRow, LastCol + 1)).FormulaR1C1 = "=VLOOKUP(RC[" & 11 - (LastCol + 1) & "],'" & nWS.Name & "'!R1C5:R" & nLastRow & "C5,1,FALSE)"

For i = LastRow To 1 Step -1
If oWS.Cells(i, (LastCol + 1)).Text = "#N/A" Then Rows(i).EntireRow.Delete
Next i
End Sub

Use that. Don't change #N/A to Cashed
 
Upvote 0
I just realized a mistake i made earlier. The column in the new sheet that has the check number is column D. Sorry for the mix up.
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,750
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top